Module: Sfp::Resource
- Defined in:
- lib/sfpagent/module.rb
Overview
predefined methods: update_state, apply, reset, resolve
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.
Instance Method Summary collapse
- #apply(p = {}) ⇒ Object
- #init(model = {}) ⇒ Object
- #resolve(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.
6 7 8 |
# File 'lib/sfpagent/module.rb', line 6 def model @model end |
#parent ⇒ Object
Returns the value of attribute parent.
5 6 7 |
# File 'lib/sfpagent/module.rb', line 5 def parent @parent end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
6 7 8 |
# File 'lib/sfpagent/module.rb', line 6 def state @state end |
#synchronized ⇒ Object
Returns the value of attribute synchronized.
5 6 7 |
# File 'lib/sfpagent/module.rb', line 5 def synchronized @synchronized end |
Instance Method Details
#apply(p = {}) ⇒ Object
24 25 26 |
# File 'lib/sfpagent/module.rb', line 24 def apply(p={}) true end |
#init(model = {}) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/sfpagent/module.rb', line 8 def init(model={}) @model = {} @state = {} @synchronized = [] update_model(model) end |
#resolve(path) ⇒ Object
35 36 37 |
# File 'lib/sfpagent/module.rb', line 35 def resolve(path) Sfp::Agent.resolve(path.simplify) end |
#to_model ⇒ Object Also known as: reset
28 29 30 31 |
# File 'lib/sfpagent/module.rb', line 28 def to_model @state = {} @model.each { |k,v| @state[k] = v } end |
#update_model(model) ⇒ Object
20 21 22 |
# File 'lib/sfpagent/module.rb', line 20 def update_model(model) model.each { |k,v| @model[k] = v } end |
#update_state ⇒ Object
16 17 18 |
# File 'lib/sfpagent/module.rb', line 16 def update_state @state = {} end |