class Toggl::Worktime::Config

Config for Toggl::Worktime

Constants

ATTRS
ATTR_DEFAULTS

Attributes

foo[RW]

Public Class Methods

load_config(path) click to toggle source
# File lib/toggl/worktime/config.rb, line 35
def load_config(path)
  YAML.safe_load(File.open(path).read).transform_keys(&:to_sym)
end
new(args) click to toggle source
# File lib/toggl/worktime/config.rb, line 29
def initialize(args)
  c = self.class.load_config(args[:path])
  attr_set(c)
end

Private Instance Methods

attr_set(hash) click to toggle source
# File lib/toggl/worktime/config.rb, line 42
def attr_set(hash)
  ATTRS.each do |k|
    send((k.to_s + '=').to_sym, hash.key?(k) ? hash[k] : ATTR_DEFAULTS[k])
  end
end