Module: TivoHMO::Config::Mixin::ClassMethods

Defined in:
lib/tivohmo/config.rb

Instance Method Summary collapse

Instance Method Details

#config_get(key) ⇒ Object



133
134
135
136
137
# File 'lib/tivohmo/config.rb', line 133

def config_get(key)
  scoped_key = config_path << key
  result = Config.instance.get(scoped_key)
  result
end

#config_register(key, default_value, description, &on_change_block) ⇒ Object

Raises:

  • (ArgumentError)


122
123
124
125
126
127
128
129
130
131
# File 'lib/tivohmo/config.rb', line 122

def config_register(key, default_value, description, &on_change_block)
  raise ArgumentError, "Config '#{key}' already registered" if Config.instance.known_config[key]

  Config.instance.known_config[key] = {
      default_value: default_value,
      description: description,
      source_path: config_path,
      on_change: on_change_block
  }
end

#config_set(key, value) ⇒ Object



139
140
141
# File 'lib/tivohmo/config.rb', line 139

def config_set(key, value)
  Config.instance.set(key, value)
end