Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Remove dependency on activesupport for each_with_object compatibility…

… 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...
commit 6052252a07baf7aefe0f100bba0abd2cbb7139bb 1 parent 9019137
@sferik authored
Showing with 4 additions and 4 deletions.
  1. +2 −2 lib/twitter/configuration.rb
  2. +2 −2 lib/twitter/photo.rb
View
4 lib/twitter/configuration.rb
@@ -1,4 +1,3 @@
-require 'active_support/core_ext/enumerable'
require 'twitter/base'
require 'twitter/size'
@@ -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
View
4 lib/twitter/photo.rb
@@ -1,4 +1,3 @@
-require 'active_support/core_ext/enumerable'
require 'twitter/base'
require 'twitter/size'
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.