0

Trying to build a Twitter app based on https://github.com/tweetstream/tweetstream. But at http://www.rubydoc.info/gems/tweetstream/TweetStream/Client -- how'd I go about ignoring retweets?

This works

TweetStream::Client.new.follow(14252, 53235) do |status|
  puts "#{status.text}"
end

Failed attempt at excluding retweets #1

# both block arg and actual block given (SyntaxError)

TweetStream::Client.new.follow(14252, 53235).reject(&:retweet) do |status|
  puts "#{status.text}"
end

Failed attempt at excluding retweets #2

# No errors but also no tweets appearing

TweetStream::Client.new.follow(14252, 53235) do |status|
  unless status.retweet
    puts "#{status.text}"
  end
end
Mark Boulder
  • 13,577
  • 12
  • 48
  • 78
  • Sorry, I don't see how that's helpful. – Mark Boulder Jun 21 '16 at 10:32
  • According to your second link, `#retweet(query_parameters = {}, &block) ⇒ Object` returns all retweets. Now I'm by no means fluent in Ruby on Rails, but I'd say you should be able to use this to block retweets as well, since it allows to target retweets only. – Tijmen Jun 21 '16 at 10:38
  • I've been trying to with `reject(&:retweet)` and `unless status.retweet` but maybe it's the wrong way to go about it? – Mark Boulder Jun 21 '16 at 10:54

0 Answers0