Module: Sfp::Resource
- Defined in:
- lib/sfpagent/module.rb
Overview
predefined methods: update_state, apply, reset, resolve
Constant Summary collapse
- @@resource =
Object.new.extend(Sfp::Resource)
Instance Attribute Summary collapse
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#parent ⇒ Object
Returns the value of attribute parent.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
-
#synchronized ⇒ Object
Returns the value of attribute synchronized.
Class Method Summary collapse
Instance Method Summary collapse
- #init(model = {}) ⇒ Object
- #resolve(path) ⇒ Object (also: #resolve_state)
- #resolve_model(path) ⇒ Object
- #to_model ⇒ Object (also: #reset)
- #update_model(model) ⇒ Object
- #update_state ⇒ Object
Instance Attribute Details
#model ⇒ Object (readonly)
Returns the value of attribute model.
12 13 14 |
# File 'lib/sfpagent/module.rb', line 12 def model @model end |
#parent ⇒ Object
Returns the value of attribute parent.
11 12 13 |
# File 'lib/sfpagent/module.rb', line 11 def parent @parent end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
12 13 14 |
# File 'lib/sfpagent/module.rb', line 12 def state @state end |
#synchronized ⇒ Object
Returns the value of attribute synchronized.
11 12 13 |
# File 'lib/sfpagent/module.rb', line 11 def synchronized @synchronized end |
Class Method Details
.resolve(path) ⇒ Object
7 8 9 |
# File 'lib/sfpagent/module.rb', line 7 def self.resolve(path) @@resource.resolve(path) end |
Instance Method Details
#init(model = {}) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/sfpagent/module.rb', line 14 def init(model={}) @model = {} @state = {} @synchronized = [] update_model(model) end |
#resolve(path) ⇒ Object Also known as: resolve_state
37 38 39 |
# File 'lib/sfpagent/module.rb', line 37 def resolve(path) Sfp::Agent.resolve(path) end |
#resolve_model(path) ⇒ Object
43 44 45 |
# File 'lib/sfpagent/module.rb', line 43 def resolve_model(path) Sfp::Agent.resolve_model(path) end |
#to_model ⇒ Object Also known as: reset
30 31 32 33 |
# File 'lib/sfpagent/module.rb', line 30 def to_model @state = {} @model.each { |k,v| @state[k] = v } end |
#update_model(model) ⇒ Object
26 27 28 |
# File 'lib/sfpagent/module.rb', line 26 def update_model(model) model.each { |k,v| @model[k] = v } end |
#update_state ⇒ Object
22 23 24 |
# File 'lib/sfpagent/module.rb', line 22 def update_state @state = {} end |