Class: Diaspora::Cluster::Creator::NodeAttribute
- Extended by:
- DependencyInjector
- Defined in:
- lib/diaspora-cluster-creator/node_attribute.rb
Instance Attribute Summary collapse
-
#node ⇒ Object
readonly
Returns the value of attribute node.
Attributes inherited from Attribute
Instance Method Summary collapse
-
#initialize(node, attribute) ⇒ NodeAttribute
constructor
A new instance of NodeAttribute.
- #label ⇒ Object
- #to_i ⇒ Object
- #to_s ⇒ Object
- #value ⇒ Object
- #value=(new_value) ⇒ Object
Methods inherited from Attribute
Constructor Details
#initialize(node, attribute) ⇒ NodeAttribute
Returns a new instance of NodeAttribute.
14 15 16 17 |
# File 'lib/diaspora-cluster-creator/node_attribute.rb', line 14 def initialize(node, attribute) @node = node super(attribute) end |
Instance Attribute Details
#node ⇒ Object (readonly)
Returns the value of attribute node.
13 14 15 |
# File 'lib/diaspora-cluster-creator/node_attribute.rb', line 13 def node @node end |
Instance Method Details
#label ⇒ Object
35 36 37 |
# File 'lib/diaspora-cluster-creator/node_attribute.rb', line 35 def label "#{super}#{to_i}" end |
#to_i ⇒ Object
27 28 29 |
# File 'lib/diaspora-cluster-creator/node_attribute.rb', line 27 def to_i value end |
#to_s ⇒ Object
31 32 33 |
# File 'lib/diaspora-cluster-creator/node_attribute.rb', line 31 def to_s "#{super}#{to_i}" end |
#value ⇒ Object
19 20 21 |
# File 'lib/diaspora-cluster-creator/node_attribute.rb', line 19 def value @value ||= dice.roll end |
#value=(new_value) ⇒ Object
23 24 25 |
# File 'lib/diaspora-cluster-creator/node_attribute.rb', line 23 def value=(new_value) @value = new_value.to_i end |