Module: Arver::NodeWithScriptHooks

Included in:
Host, Partition
Defined in:
lib/arver/node_with_script_hooks.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#post_closeObject

Returns the value of attribute post_close.



3
4
5
# File 'lib/arver/node_with_script_hooks.rb', line 3

def post_close
  @post_close
end

#post_openObject

Returns the value of attribute post_open.



3
4
5
# File 'lib/arver/node_with_script_hooks.rb', line 3

def post_open
  @post_open
end

#pre_closeObject

Returns the value of attribute pre_close.



3
4
5
# File 'lib/arver/node_with_script_hooks.rb', line 3

def pre_close
  @pre_close
end

#pre_openObject

Returns the value of attribute pre_open.



3
4
5
# File 'lib/arver/node_with_script_hooks.rb', line 3

def pre_open
  @pre_open
end

Instance Method Details

#script_hooks_from_hash(hash) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/arver/node_with_script_hooks.rb', line 12

def script_hooks_from_hash( hash )
  hash.each do | name, data |
    self.pre_open= data if name == "pre_open"
    self.pre_close= data if name == "pre_close"
    self.post_open= data if name == "post_open"
    self.post_close= data if name == "post_close"
  end
  hash.delete("pre_open") 
  hash.delete("pre_close") 
  hash.delete("post_open") 
  hash.delete("post_close") 
end

#script_hooks_to_yamlObject



4
5
6
7
8
9
10
11
# File 'lib/arver/node_with_script_hooks.rb', line 4

def script_hooks_to_yaml
  yaml = ""
  yaml << "'pre_open': '#{pre_open}'\n" unless pre_open.nil?
  yaml << "'pre_close': '#{pre_close}'\n" unless pre_close.nil?
  yaml << "'post_open': '#{post_open}'\n" unless post_open.nil?
  yaml << "'post_close': '#{post_close}'\n" unless post_close.nil?
  yaml
end