Class: Config

Inherits:
Object
  • Object
show all
Defined in:
lib/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#authObject (readonly)

Returns the value of attribute auth.



2
3
4
# File 'lib/config.rb', line 2

def auth
  @auth
end

#cutoff_dateObject (readonly)

Returns the value of attribute cutoff_date.



2
3
4
# File 'lib/config.rb', line 2

def cutoff_date
  @cutoff_date
end

#cutoff_timestampObject (readonly)

Returns the value of attribute cutoff_timestamp.



2
3
4
# File 'lib/config.rb', line 2

def cutoff_timestamp
  @cutoff_timestamp
end

Instance Method Details

#load_envObject



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