Class: Retrobot::Config
- Inherits:
-
Object
- Object
- Retrobot::Config
- Defined in:
- lib/retrobot/config.rb
Constant Summary collapse
- KEYS =
i( tweets_csv consumer_key consumer_secret access_token access_secret retro_days retweet debug dryrun loop_interval retry_interval retry_count add_in_reply_to_url suppress_pattern remove_hashtag )
- DEFAULTS =
{ tweets_csv: './tweets/tweets.csv', retro_days: 365, retweet: false, debug: false, dryrun: false, loop_interval: 3, retry_interval: 3, retry_count: 5, add_in_reply_to_url: false, suppress_pattern: nil, remove_hashtag: false, dying_mention_to: nil, }
Instance Method Summary collapse
- #dying_mention_to ⇒ Object
-
#initialize(options = {}) ⇒ Config
constructor
A new instance of Config.
- #load_yaml_file!(path) ⇒ Object
- #loop_interval ⇒ Object
- #merge!(hash) ⇒ Object
- #retro_days ⇒ Object
- #retry_count ⇒ Object
- #retry_interval ⇒ Object
- #tweets_csv ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Config
Returns a new instance of Config.
41 42 43 |
# File 'lib/retrobot/config.rb', line 41 def initialize(={}) = DEFAULTS.merge(.symbolize_keys) end |
Instance Method Details
#dying_mention_to ⇒ Object
65 66 67 68 69 70 |
# File 'lib/retrobot/config.rb', line 65 def return nil unless [:dying_mention_to] # add mention mark (atmark) [:dying_mention_to].start_with?('@') ? [:dying_mention_to] : "@" + [:dying_mention_to] end |
#load_yaml_file!(path) ⇒ Object
72 73 74 |
# File 'lib/retrobot/config.rb', line 72 def load_yaml_file!(path) .merge! Psych.load_file(path.to_s).symbolize_keys end |
#loop_interval ⇒ Object
61 |
# File 'lib/retrobot/config.rb', line 61 def loop_interval; [:loop_interval].to_i; end |
#merge!(hash) ⇒ Object
45 46 47 |
# File 'lib/retrobot/config.rb', line 45 def merge!(hash) .merge!(hash) end |
#retro_days ⇒ Object
53 54 55 |
# File 'lib/retrobot/config.rb', line 53 def retro_days [:retro_days].to_i.days end |
#retry_count ⇒ Object
63 |
# File 'lib/retrobot/config.rb', line 63 def retry_count; [:retry_count].to_i; end |
#retry_interval ⇒ Object
62 |
# File 'lib/retrobot/config.rb', line 62 def retry_interval; [:retry_interval].to_i; end |
#tweets_csv ⇒ Object
57 58 59 |
# File 'lib/retrobot/config.rb', line 57 def tweets_csv Pathname.new([:tweets_csv]) end |