Class: Mandy::Tuple
- Inherits:
-
Object
- Object
- Mandy::Tuple
- Defined in:
- lib/mandy/support/tuple.rb
Constant Summary collapse
- SEPERATOR =
','
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#value ⇒ Object
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(name, value, name_accessor = nil, value_accessor = nil) ⇒ Tuple
constructor
A new instance of Tuple.
- #inspect ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(name, value, name_accessor = nil, value_accessor = nil) ⇒ Tuple
Returns a new instance of Tuple.
8 9 10 11 12 |
# File 'lib/mandy/support/tuple.rb', line 8 def initialize(name, value, name_accessor = nil, value_accessor = nil) @name, @value = name, value alias_accessor(name_accessor, :name) unless name_accessor.nil? alias_accessor(value_accessor, :value) unless value_accessor.nil? end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'lib/mandy/support/tuple.rb', line 6 def name @name end |
#value ⇒ Object
Returns the value of attribute value.
6 7 8 |
# File 'lib/mandy/support/tuple.rb', line 6 def value @value end |
Class Method Details
Instance Method Details
#==(other) ⇒ Object
28 29 30 31 |
# File 'lib/mandy/support/tuple.rb', line 28 def ==(other) return false unless self.class == other.class self.name == other.name && self.value == other.value end |
#inspect ⇒ Object
24 25 26 |
# File 'lib/mandy/support/tuple.rb', line 24 def inspect %(<Tuple #{self.to_s}>) end |
#to_s ⇒ Object
14 15 16 |
# File 'lib/mandy/support/tuple.rb', line 14 def to_s %(#{@name}#{SEPERATOR}#{@value}) end |