Class: Cuboid::State
- Inherits:
-
Object
show all
- Defined in:
- lib/cuboid/state.rb,
lib/cuboid/state/options.rb,
lib/cuboid/state/application.rb
Overview
Stores and provides access to the state of the system.
Defined Under Namespace
Classes: Application, Error, Options
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
.application ⇒ Framework
25
26
27
|
# File 'lib/cuboid/state.rb', line 25
def application
@application
end
|
22
23
24
|
# File 'lib/cuboid/state.rb', line 22
def options
@options
end
|
Class Method Details
69
70
71
72
|
# File 'lib/cuboid/state.rb', line 69
def clear
each { |_, state| state.clear }
self
end
|
.dump(directory) ⇒ String
45
46
47
48
49
50
51
52
53
|
# File 'lib/cuboid/state.rb', line 45
def dump( directory )
FileUtils.mkdir_p( directory )
each do |name, state|
state.dump( "#{directory}/#{name}/" )
end
directory
end
|
.load(directory) ⇒ State
60
61
62
63
64
65
66
|
# File 'lib/cuboid/state.rb', line 60
def load( directory )
each do |name, state|
send( "#{name}=", state.class.load( "#{directory}/#{name}/" ) )
end
self
end
|
27
28
29
30
|
# File 'lib/cuboid/state.rb', line 27
def reset
@options = Options.new
@application = Application.new
end
|
.statistics ⇒ Object
32
33
34
35
36
37
38
|
# File 'lib/cuboid/state.rb', line 32
def statistics
stats = {}
each do |attribute|
stats[attribute] = send(attribute).statistics
end
stats
end
|