Class: TwitterTopicBot::TweetFilterer
- Inherits:
-
Object
- Object
- TwitterTopicBot::TweetFilterer
- Defined in:
- lib/twitter_topic_bot/tweet_filterer.rb
Instance Method Summary collapse
- #acceptable_tweet?(tweet_str, allow_links: true) ⇒ Boolean
-
#initialize(options = {}) ⇒ TweetFilterer
constructor
A new instance of TweetFilterer.
Constructor Details
#initialize(options = {}) ⇒ TweetFilterer
Returns a new instance of TweetFilterer.
3 4 5 6 |
# File 'lib/twitter_topic_bot/tweet_filterer.rb', line 3 def initialize( = {}) @max_num_mentions = .fetch(:max_num_mentions, 1) = .fetch(:max_num_hashtags, 3) end |
Instance Method Details
#acceptable_tweet?(tweet_str, allow_links: true) ⇒ Boolean
8 9 10 11 12 13 14 15 |
# File 'lib/twitter_topic_bot/tweet_filterer.rb', line 8 def acceptable_tweet?(tweet_str, allow_links: true) return false if is_spammy_tweet?(tweet_str) || is_sketchy_tweet?(tweet_str) || has_too_many_mentions?(tweet_str) || (tweet_str) allow_links || !contains_link?(tweet_str) end |