Class: ClassifyCluster::Configurator::Role
- Inherits:
-
Object
- Object
- ClassifyCluster::Configurator::Role
- Defined in:
- lib/classify_cluster/configurator/role.rb
Instance Attribute Summary collapse
-
#node ⇒ Object
readonly
Returns the value of attribute node.
-
#options(value = nil) ⇒ Object
readonly
Returns the value of attribute options.
-
#type(value = nil) ⇒ Object
readonly
Returns the value of attribute type.
-
#variables ⇒ Object
readonly
Returns the value of attribute variables.
Instance Method Summary collapse
-
#initialize(node, type, options = {}, &block) ⇒ Role
constructor
A new instance of Role.
- #variable(name, value) ⇒ Object
Constructor Details
#initialize(node, type, options = {}, &block) ⇒ Role
Returns a new instance of Role.
27 28 29 30 31 32 33 34 |
# File 'lib/classify_cluster/configurator/role.rb', line 27 def initialize(node, type, ={}, &block) @type = type @options = HashWithIndifferentAccess.new() @node = node @variables = {} block.call(self) if block_given? self.send("after_#{@type}_role_assignment".to_sym) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args) ⇒ Object (private)
108 109 110 111 |
# File 'lib/classify_cluster/configurator/role.rb', line 108 def method_missing(method_name, *args) add_klass_from_role add_variable_from_role end |
Instance Attribute Details
#node ⇒ Object (readonly)
Returns the value of attribute node.
26 27 28 |
# File 'lib/classify_cluster/configurator/role.rb', line 26 def node @node end |
#options(value = nil) ⇒ Object (readonly)
Returns the value of attribute options.
26 27 28 |
# File 'lib/classify_cluster/configurator/role.rb', line 26 def @options end |
#type(value = nil) ⇒ Object (readonly)
Returns the value of attribute type.
26 27 28 |
# File 'lib/classify_cluster/configurator/role.rb', line 26 def type @type end |
#variables ⇒ Object (readonly)
Returns the value of attribute variables.
26 27 28 |
# File 'lib/classify_cluster/configurator/role.rb', line 26 def variables @variables end |
Instance Method Details
#variable(name, value) ⇒ Object
43 44 45 46 |
# File 'lib/classify_cluster/configurator/role.rb', line 43 def variable(name, value) @variables[name] = value @node.variable name, value end |