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

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#modelObject (readonly)

Returns the value of attribute model.



12
13
14
# File 'lib/sfpagent/module.rb', line 12

def model
  @model
end

#parentObject

Returns the value of attribute parent.



11
12
13
# File 'lib/sfpagent/module.rb', line 11

def parent
  @parent
end

#stateObject (readonly)

Returns the value of attribute state.



12
13
14
# File 'lib/sfpagent/module.rb', line 12

def state
  @state
end

#synchronizedObject

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



22
23
24
# File 'lib/sfpagent/module.rb', line 22

def update_state
	@state = {}
end