Class: Toggl::Worktime::Config
- Inherits:
-
Object
- Object
- Toggl::Worktime::Config
- Defined in:
- lib/toggl/worktime/config.rb
Overview
Config for Toggl::Worktime
Constant Summary collapse
- ATTRS =
%i[ working_interval_min day_begin_hour timezone ignore_conditions ].freeze
- ATTR_DEFAULTS =
{ working_interval_min: 10, day_begin_hour: 6, timezone: 'Asia/Tokyo', ignore_conditions: [] }.freeze
Instance Attribute Summary collapse
-
#foo ⇒ Object
Returns the value of attribute foo.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(args) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(args) ⇒ Config
Returns a new instance of Config.
29 30 31 32 |
# File 'lib/toggl/worktime/config.rb', line 29 def initialize(args) c = self.class.load_config(args[:path]) attr_set(c) end |
Instance Attribute Details
#foo ⇒ Object
Returns the value of attribute foo.
9 10 11 |
# File 'lib/toggl/worktime/config.rb', line 9 def foo @foo end |
Class Method Details
.load_config(path) ⇒ Object
35 36 37 |
# File 'lib/toggl/worktime/config.rb', line 35 def load_config(path) YAML.safe_load(File.open(path).read).transform_keys(&:to_sym) end |