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 debug dryrun loop_interval retry_interval retry_count )
- DEFAULTS =
{ tweets_csv: './tweets/tweets.csv', retro_days: 365, debug: false, dryrun: false, loop_interval: 3, retry_interval: 3, retry_count: 5 }
Instance Method Summary collapse
-
#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
Instance Method Details
#load_yaml_file!(path) ⇒ Object
54 55 56 |
# File 'lib/retrobot/config.rb', line 54 def load_yaml_file!(path) @options.merge! Psych.load_file(path.to_s).symbolize_keys end |
#loop_interval ⇒ Object
50 |
# File 'lib/retrobot/config.rb', line 50 def loop_interval; @options[:loop_interval].to_i; end |
#merge!(hash) ⇒ Object
34 35 36 |
# File 'lib/retrobot/config.rb', line 34 def merge!(hash) @options.merge!(hash) end |
#retro_days ⇒ Object
42 43 44 |
# File 'lib/retrobot/config.rb', line 42 def retro_days @options[:retro_days].to_i.days end |
#retry_count ⇒ Object
52 |
# File 'lib/retrobot/config.rb', line 52 def retry_count; @options[:retry_count].to_i; end |
#retry_interval ⇒ Object
51 |
# File 'lib/retrobot/config.rb', line 51 def retry_interval; @options[:retry_interval].to_i; end |
#tweets_csv ⇒ Object
46 47 48 |
# File 'lib/retrobot/config.rb', line 46 def tweets_csv Pathname.new(@options[:tweets_csv]) end |