Class: Bcome::Node::Base
- Includes:
- CommandHelper
- Defined in:
- lib/nodes/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#meta_data ⇒ Object
readonly
Returns the value of attribute meta_data.
-
#stack_peer ⇒ Object
readonly
Returns the value of attribute stack_peer.
Instance Method Summary collapse
-
#initialize(meta_data) ⇒ Base
constructor
A new instance of Base.
- #interactive ⇒ Object
- #machines ⇒ Object
- #method_missing(method_sym, *arguments, &block) ⇒ Object
-
#run(raw_command, bootstrap = false) ⇒ Object
Runs a command over every machine in this node.
- #set_parent_reference(parent, parent_reference_key, collection_key) ⇒ Object
- #set_stack_peer(stack_instance) ⇒ Object
Methods included from CommandHelper
Constructor Details
#initialize(meta_data) ⇒ Base
Returns a new instance of Base.
12 13 14 |
# File 'lib/nodes/base.rb', line 12 def initialize() construct() end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_sym, *arguments, &block) ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/nodes/base.rb', line 33 def method_missing(method_sym, *arguments, &block) if instance_variable_defined?("@#{method_sym}") return instance_variable_get("@#{method_sym}") else super end end |
Instance Attribute Details
#meta_data ⇒ Object (readonly)
Returns the value of attribute meta_data.
6 7 8 |
# File 'lib/nodes/base.rb', line 6 def @meta_data end |
#stack_peer ⇒ Object (readonly)
Returns the value of attribute stack_peer.
6 7 8 |
# File 'lib/nodes/base.rb', line 6 def stack_peer @stack_peer end |
Instance Method Details
#interactive ⇒ Object
20 21 22 |
# File 'lib/nodes/base.rb', line 20 def interactive stack_peer.interactive end |
#machines ⇒ Object
8 9 10 |
# File 'lib/nodes/base.rb', line 8 def machines raise "Should be overriden" end |
#run(raw_command, bootstrap = false) ⇒ Object
Runs a command over every machine in this node
25 26 27 28 29 30 31 |
# File 'lib/nodes/base.rb', line 25 def run(raw_command, bootstrap = false) return unless machines machines.pmap {|machine| machine.run([raw_command], bootstrap) } return end |
#set_parent_reference(parent, parent_reference_key, collection_key) ⇒ Object
41 42 43 44 45 |
# File 'lib/nodes/base.rb', line 41 def set_parent_reference(parent, parent_reference_key, collection_key) instance_variable_get("@#{collection_key}").map{|collection_item| collection_item.instance_variable_set("@#{parent_reference_key}", parent) } end |
#set_stack_peer(stack_instance) ⇒ Object
16 17 18 |
# File 'lib/nodes/base.rb', line 16 def set_stack_peer(stack_instance) @stack_peer = stack_instance end |