Class: Expirer::Config
- Inherits:
-
Object
- Object
- Expirer::Config
- Defined in:
- lib/expirer/config.rb
Constant Summary collapse
- DEFAULTS =
{ private_only: true, expire_date: '1 year ago' }.freeze
- OPTIONS =
[:username, :password, :organization, :private_only, :expire_date]
Instance Method Summary collapse
- #expire_date ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #load_from_file!(file) ⇒ Object
- #load_from_options!(options) ⇒ Object
- #private_only? ⇒ Boolean
- #reset! ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
15 16 17 |
# File 'lib/expirer/config.rb', line 15 def initialize reset! end |
Instance Method Details
#expire_date ⇒ Object
31 32 33 |
# File 'lib/expirer/config.rb', line 31 def expire_date @parsed_expire_date ||= Chronic.parse(@expire_date).to_datetime end |
#load_from_file!(file) ⇒ Object
19 20 21 |
# File 'lib/expirer/config.rb', line 19 def load_from_file!(file) (config_from_file(file)) if file && File.exists?(file) end |
#load_from_options!(options) ⇒ Object
27 28 29 |
# File 'lib/expirer/config.rb', line 27 def () (.underscore_keys.symbolize_keys) end |
#private_only? ⇒ Boolean
35 36 37 |
# File 'lib/expirer/config.rb', line 35 def private_only? private_only end |
#reset! ⇒ Object
23 24 25 |
# File 'lib/expirer/config.rb', line 23 def reset! (DEFAULTS) end |