ruby-on-railsrubyruby-on-rails-4tweetstream

Ruby - undefined method `extract_options!' : Array


While running following sample using TweetStream I am getting mentioned error.

tweets.rb

require 'tweetstream'

TweetStream.configure do |config|
  config.consumer_key       = '<CONSUMER KEY>'
  config.consumer_secret    = '<CONSUMER SECRET>'
  config.oauth_token        = '<OAUTH TOKEN>'
  config.oauth_token_secret = '<OAUTH TOKEN SECRET'
  config.auth_method        = :oauth
end

TweetStream::Client.new.track('ruby') do |status|
  puts "#{status.text}"
end

Error

$ ruby tweets.rb 
/home/amit/.rvm/gems/ruby-1.9.3-p194/gems/tweetstream-2.3.0/lib/tweetstream/client.rb:96:in `track': undefined method `extract_options!' for ["ruby"]:Array (NoMethodError)
        from tweets.rb:11:in `<main>'
    https://github.com/intridea/tweetstream

Am I missing something?


Solution

  • extract_options! is ActiveSupport method. If it's not rails app you need to install it and include into script.