Skip to content

Commit

Permalink
Remove dependency on activesupport for each_with_object compatibility…
Browse files Browse the repository at this point in the history
… in Ruby 1.8

Use Enumerable#inject instead. This change can be reverted when the
required Ruby version >= 1.9.

Progress toward #264.
  • Loading branch information
sferik committed Jun 1, 2012
1 parent 9019137 commit 6052252
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/twitter/configuration.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
require 'active_support/core_ext/enumerable'
require 'twitter/base'
require 'twitter/size'

Expand All @@ -11,8 +10,9 @@ class Configuration < Twitter::Base
#
# @return [Array<Twitter::Size>]
def photo_sizes
@photo_sizes ||= Array(@attrs['photo_sizes']).each_with_object({}) do |(key, value), object|
@photo_sizes ||= Array(@attrs['photo_sizes']).inject({}) do |object, (key, value)|
object[key] = Twitter::Size.new(value)
object
end
end

Expand Down
4 changes: 2 additions & 2 deletions lib/twitter/photo.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
require 'active_support/core_ext/enumerable'
require 'twitter/base'
require 'twitter/size'

Expand All @@ -15,8 +14,9 @@ def ==(other)

# @return [Array<Twitter::Size>]
def sizes
@sizes ||= Array(@attrs['sizes']).each_with_object({}) do |(key, value), object|
@sizes ||= Array(@attrs['sizes']).inject({}) do |object, (key, value)|
object[key] = Twitter::Size.new(value)
object
end
end

Expand Down

0 comments on commit 6052252

Please sign in to comment.