diff --git a/lib/twitter/core_ext/kernel.rb b/lib/twitter/core_ext/kernel.rb new file mode 100644 index 000000000..50f0ca181 --- /dev/null +++ b/lib/twitter/core_ext/kernel.rb @@ -0,0 +1,15 @@ +module Kernel + + # Returns the object's singleton class. + def singleton_class + class << self + self + end + end unless respond_to?(:singleton_class) # exists in 1.9.2 + + # class_eval on an object acts like singleton_class.class_eval. + def class_eval(*args, &block) + singleton_class.class_eval(*args, &block) + end + +end diff --git a/lib/twitter/cursor.rb b/lib/twitter/cursor.rb index 539cfbad9..2b41afa8c 100644 --- a/lib/twitter/cursor.rb +++ b/lib/twitter/cursor.rb @@ -1,5 +1,5 @@ -require 'active_support/core_ext/kernel/singleton_class' require 'twitter/base' +require 'twitter/core_ext/kernel' module Twitter class Cursor < Twitter::Base @@ -23,7 +23,7 @@ def initialize(attrs, method, klass=nil) item end end - singleton_class.class_eval do + class_eval do alias_method method.to_sym, :collection end end diff --git a/twitter.gemspec b/twitter.gemspec index f291e33be..56755bbed 100644 --- a/twitter.gemspec +++ b/twitter.gemspec @@ -2,7 +2,6 @@ require File.expand_path('../lib/twitter/version', __FILE__) Gem::Specification.new do |gem| - gem.add_dependency 'activesupport', ['>= 2.3.9', '< 4'] gem.add_dependency 'faraday', '~> 0.8' gem.add_dependency 'multi_json', '~> 1.3' gem.add_dependency 'simple_oauth', '~> 0.1.6'