Class: DS::Pair

Inherits:
Object
  • Object
show all
Defined in:
lib/ds/pair.rb

Overview

Simple class for key, value objects

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(x, y) ⇒ Pair

Returns a new instance of Pair.



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

def initialize(x, y)
  @key = x
  @value = y
end

Instance Attribute Details

#keyObject Also known as: first

Returns the value of attribute key.



4
5
6
# File 'lib/ds/pair.rb', line 4

def key
  @key
end

#valueObject Also known as: second

Returns the value of attribute value.



4
5
6
# File 'lib/ds/pair.rb', line 4

def value
  @value
end