class MikuTwitter::RateLimiting::Resource

APIのリソース。 Resource = Struct.new(:limit, :remain, :reset, :endpoint)

Attributes

endpoint[R]
limit[R]
remain[R]
reset[R]

Public Class Methods

new(limit, remain, reset, endpoint) click to toggle source
# File core/lib/mikutwitter/rate_limiting.rb, line 12
def initialize(limit, remain, reset, endpoint)
  type_strict [[limit, Numeric], [remain, Numeric], [reset, Time], [endpoint, :to_s]]
  @limit, @remain, @reset, @endpoint = limit, remain, reset.freeze, endpoint.to_s.freeze
end

Public Instance Methods

inspect() click to toggle source
# File core/lib/mikutwitter/rate_limiting.rb, line 23
def inspect
  "#<MikuTwitter::RateLimiting::Resource #{@endpoint}:#{@remain}/#{@limit} #{@reset}>" end
Also aliased as: to_s
limit?() click to toggle source

規制されているなら真

# File core/lib/mikutwitter/rate_limiting.rb, line 20
def limit?
  remain and reset and remain <= 0 and Time.new <= reset end
to_s()
Alias for: inspect