Class: Bcome::Node::Base

Inherits:
Object show all
Includes:
CommandHelper
Defined in:
lib/nodes/base.rb

Direct Known Subclasses

Environment, Estate, Instance, Platform

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from CommandHelper

#run_local

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



16
17
18
19
20
21
22
# File 'lib/nodes/base.rb', line 16

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_dataObject (readonly)

Returns the value of attribute meta_data.



6
7
8
# File 'lib/nodes/base.rb', line 6

def 
  @meta_data
end

Instance Method Details

#machinesObject



8
9
10
# File 'lib/nodes/base.rb', line 8

def machines
  raise "Should be overriden"
end

#set_parent_reference(parent, parent_reference_key, collection_key) ⇒ Object



24
25
26
27
28
# File 'lib/nodes/base.rb', line 24

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