Class: Diaspora::Cluster::Creator::NodeAttribute

Inherits:
Attribute
  • Object
show all
Extended by:
DependencyInjector
Defined in:
lib/diaspora-cluster-creator/node_attribute.rb

Instance Attribute Summary collapse

Attributes inherited from Attribute

#name, #prefix

Instance Method Summary collapse

Methods inherited from Attribute

#to_sym

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

#nodeObject (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

#labelObject



35
36
37
# File 'lib/diaspora-cluster-creator/node_attribute.rb', line 35

def label
  "#{super}#{to_i}"
end

#to_iObject



27
28
29
# File 'lib/diaspora-cluster-creator/node_attribute.rb', line 27

def to_i
  value
end

#to_sObject



31
32
33
# File 'lib/diaspora-cluster-creator/node_attribute.rb', line 31

def to_s
  "#{super}#{to_i}"
end

#valueObject



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