Class: Config
- Inherits:
-
Object
- Object
- Config
- Defined in:
- lib/config.rb
Instance Attribute Summary collapse
-
#auth ⇒ Object
readonly
Returns the value of attribute auth.
-
#cutoff_date ⇒ Object
readonly
Returns the value of attribute cutoff_date.
-
#cutoff_timestamp ⇒ Object
readonly
Returns the value of attribute cutoff_timestamp.
Instance Method Summary collapse
-
#initialize(host:, token:, days:) ⇒ Config
constructor
A new instance of Config.
- #load_env ⇒ Object
Constructor Details
#initialize(host:, token:, days:) ⇒ Config
Returns a new instance of Config.
4 5 6 7 8 9 10 11 12 |
# File 'lib/config.rb', line 4 def initialize(host:, token:, days:) require 'date' @cutoff_date = Date.today - days.to_i @cutoff_timestamp = @cutoff_date.to_time.to_i @auth = { :host => host, :token => token } end |
Instance Attribute Details
#auth ⇒ Object (readonly)
Returns the value of attribute auth.
2 3 4 |
# File 'lib/config.rb', line 2 def auth @auth end |
#cutoff_date ⇒ Object (readonly)
Returns the value of attribute cutoff_date.
2 3 4 |
# File 'lib/config.rb', line 2 def cutoff_date @cutoff_date end |
#cutoff_timestamp ⇒ Object (readonly)
Returns the value of attribute cutoff_timestamp.
2 3 4 |
# File 'lib/config.rb', line 2 def @cutoff_timestamp end |
Instance Method Details
#load_env ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/config.rb', line 14 def load_env require 'dotenv' begin Dotenv.load rescue p 'Could not load environment variables.' exit(false) end end |