Skip to content

Commit

Permalink
Combine #retry_after and #reset_in into a single method
Browse files Browse the repository at this point in the history
Progress toward #289.
  • Loading branch information
sferik committed Jul 17, 2012
1 parent b103bef commit 1702f05
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions lib/twitter/rate_limit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,13 @@ def reset_at

# @return [Integer]
def reset_in
[(reset_at - Time.now).ceil, 0].max if reset_at
end

# @return [Integer]
def retry_after
retry_after = @response_headers.values_at('retry-after', 'Retry-After').compact.first
retry_after.to_i if retry_after
if retry_after = @response_headers.values_at('retry-after', 'Retry-After').compact.first
retry_after.to_i
elsif reset_at
[(reset_at - Time.now).ceil, 0].max
end
end
alias retry_after reset_in

# Update the attributes of a Relationship
#
Expand Down

0 comments on commit 1702f05

Please sign in to comment.