Module: Sfp::Resource

Defined in:
lib/sfpagent/module.rb

Overview

predefined methods: update_state, apply, reset, resolve

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#modelObject (readonly)

Returns the value of attribute model.



6
7
8
# File 'lib/sfpagent/module.rb', line 6

def model
  @model
end

#parentObject

Returns the value of attribute parent.



5
6
7
# File 'lib/sfpagent/module.rb', line 5

def parent
  @parent
end

#stateObject (readonly)

Returns the value of attribute state.



6
7
8
# File 'lib/sfpagent/module.rb', line 6

def state
  @state
end

#synchronizedObject

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_modelObject 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_stateObject



16
17
18
# File 'lib/sfpagent/module.rb', line 16

def update_state
  @state = {}
end