Class: Lab42::Pair

Inherits:
Object
  • Object
show all
Includes:
EqAndPatterns
Defined in:
lib/lab42/pair.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from EqAndPatterns

#==, #[], #deconstruct

Instance Attribute Details

#firstObject (readonly)

Returns the value of attribute first.



6
7
8
# File 'lib/lab42/pair.rb', line 6

def first
  @first
end

#secondObject (readonly)

Returns the value of attribute second.



6
7
8
# File 'lib/lab42/pair.rb', line 6

def second
  @second
end

Instance Method Details

#set_first(new_first) ⇒ Object



13
# File 'lib/lab42/pair.rb', line 13

def set_first(new_first) = self.class.new(new_first, second)

#set_second(new_second) ⇒ Object



14
# File 'lib/lab42/pair.rb', line 14

def set_second(new_second) = self.class.new(first, new_second)

#to_aObject



9
10
11
# File 'lib/lab42/pair.rb', line 9

def to_a
  [first, second]
end