Class: Reconfig::Namespace

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(meta_key, opts = {}) ⇒ Namespace

Returns a new instance of Namespace.



6
7
8
9
10
11
# File 'lib/reconfig/namespace.rb', line 6

def initialize(meta_key, opts={})
  @meta_key = meta_key
  @options = {
    prefix: meta_key + ':'
  }.merge opts
end

Instance Attribute Details

#meta_keyObject

Returns the value of attribute meta_key.



4
5
6
# File 'lib/reconfig/namespace.rb', line 4

def meta_key
  @meta_key
end

#optionsObject

Returns the value of attribute options.



4
5
6
# File 'lib/reconfig/namespace.rb', line 4

def options
  @options
end

Instance Method Details

#[](key) ⇒ Object



22
23
24
# File 'lib/reconfig/namespace.rb', line 22

def [](key)
  config[key]
end

#[]=(key, value) ⇒ Object



26
27
28
29
# File 'lib/reconfig/namespace.rb', line 26

def []=(key, value)
  set(key, value)
  config[key] = value
end

#configObject



13
14
15
# File 'lib/reconfig/namespace.rb', line 13

def config
  @config ||= refresh_config
end

#refreshObject



17
18
19
20
# File 'lib/reconfig/namespace.rb', line 17

def refresh
  refresh_keyspace
  refresh_config
end