views:

33

answers:

1

here is my code

require 'rubygems'
require 'tweetstream'

TweetStream::Client.new('usr','pswd').sample do |status|
 puts "#{status.text}"
end

when i run this code i get:

./tweetstream.rb:6: uninitialized constant TweetStream (NameError)
from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
from tweetstream.rb:2

when i type gem list: ... thor (0.14.0) tiny_mce (0.1.4) treetop (1.4.8) tweetstream (1.0.4) twitter-stream (0.1.9) tzinfo (0.3.23) ...

i dont understand i have the gem installed , i require it in my script but the TweetStream is not recognized.Thnak you for your help.

+2  A: 

This is probably because your file name is tweetstream.rb.

'require' loads this same file and can't find a definition of TweetStream constant in it.

Change the filename to make it work.

Rishav Rastogi