Class: Dri::Support::Configuration
- Inherits:
-
Object
- Object
- Dri::Support::Configuration
- Includes:
- Utils::Helpers
- Defined in:
- lib/dri/support/configuration.rb
Constant Summary collapse
- TZ =
{ "AMER" => "America/New_York", "EMEA" => "Europe/London", "APAC" => "Asia/Tokyo" }.freeze
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #emoji ⇒ Object
- #handover_report_path ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #ops_token ⇒ Object
- #profile ⇒ Object
- #timezone ⇒ Object
- #token ⇒ Object
- #tz ⇒ Object
- #username ⇒ Object
Methods included from Utils::Helpers
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
17 18 19 20 21 22 23 24 |
# File 'lib/dri/support/configuration.rb', line 17 def initialize @config = TTY::Config.new do |conf| conf.filename = ".dri_profile" conf.extname = ".yml" conf.append_path Dir.home conf.append_path Dir.pwd end end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
26 27 28 |
# File 'lib/dri/support/configuration.rb', line 26 def config @config end |
Instance Method Details
#emoji ⇒ Object
32 33 34 |
# File 'lib/dri/support/configuration.rb', line 32 def emoji @emoji ||= profile["settings"]["emoji"] end |
#handover_report_path ⇒ Object
48 49 50 51 |
# File 'lib/dri/support/configuration.rb', line 48 def handover_report_path @handover_report_path ||= profile["settings"]["handover_report_path"] || File.join(Dir.home, ".handover_reports") end |
#ops_token ⇒ Object
44 45 46 |
# File 'lib/dri/support/configuration.rb', line 44 def ops_token @ops_token ||= profile["settings"]["ops_token"] end |
#profile ⇒ Object
28 29 30 |
# File 'lib/dri/support/configuration.rb', line 28 def profile @profile ||= config.read end |
#timezone ⇒ Object
53 54 55 |
# File 'lib/dri/support/configuration.rb', line 53 def timezone @timezone ||= profile["settings"]["timezone"] end |
#token ⇒ Object
40 41 42 |
# File 'lib/dri/support/configuration.rb', line 40 def token @token ||= profile["settings"]["token"] end |
#tz ⇒ Object
57 58 59 |
# File 'lib/dri/support/configuration.rb', line 57 def tz @tz ||= TZInfo::Timezone.get(profile["settings"]["tz"] || TZ[timezone]) end |
#username ⇒ Object
36 37 38 |
# File 'lib/dri/support/configuration.rb', line 36 def username @username ||= profile["settings"]["user"] end |