Class: Configatron::RootStore

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Singleton
Defined in:
lib/configatron/root_store.rb

Overview

This is the root configatron object, and contains methods which operate on the entire configatron hierarchy.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRootStore

Returns a new instance of RootStore.



15
16
17
18
# File 'lib/configatron/root_store.rb', line 15

def initialize
  @locked = false
  reset!
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



20
21
22
# File 'lib/configatron/root_store.rb', line 20

def method_missing(name, *args, &block)
  store.send(name, *args, &block)
end

Instance Attribute Details

#storeObject (readonly)

Returns the value of attribute store.



7
8
9
# File 'lib/configatron/root_store.rb', line 7

def store
  @store
end

Instance Method Details

#lock!Object



46
47
48
# File 'lib/configatron/root_store.rb', line 46

def lock!
  @locked = true
end

#locked?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/configatron/root_store.rb', line 42

def locked?
  @locked
end

#reset!Object



24
25
26
# File 'lib/configatron/root_store.rb', line 24

def reset!
  @store = Configatron::Store.new(self)
end

#temp(&block) ⇒ Object



28
29
30
31
32
# File 'lib/configatron/root_store.rb', line 28

def temp(&block)
  temp_start
  yield
  temp_end
end

#temp_endObject



38
39
40
# File 'lib/configatron/root_store.rb', line 38

def temp_end
  @store = @temp
end

#temp_startObject



34
35
36
# File 'lib/configatron/root_store.rb', line 34

def temp_start
  @temp = Configatron::DeepClone.deep_clone(@store)
end

#unlock!Object



50
51
52
# File 'lib/configatron/root_store.rb', line 50

def unlock!
  @locked = false
end