Class: Array::Tag

Inherits:
Object show all
Defined in:
lib/andromeda/patch/array_bin_search.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key, value = nil) ⇒ Tag

Returns a new instance of Tag.



7
8
9
10
# File 'lib/andromeda/patch/array_bin_search.rb', line 7

def initialize(key, value = nil)
  @key   = key
  @value = value
end

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



4
5
6
# File 'lib/andromeda/patch/array_bin_search.rb', line 4

def key
  @key
end

#valueObject

Returns the value of attribute value.



5
6
7
# File 'lib/andromeda/patch/array_bin_search.rb', line 5

def value
  @value
end

Instance Method Details

#<=>(other) ⇒ Object



14
15
16
# File 'lib/andromeda/patch/array_bin_search.rb', line 14

def <=>(other)
  return key <=> other.key
end

#to_sObject Also known as: inspect



18
19
20
# File 'lib/andromeda/patch/array_bin_search.rb', line 18

def to_s
  "Tag(#{key.to_s} => #{value.to_s})"
end

#untaggedObject



12
# File 'lib/andromeda/patch/array_bin_search.rb', line 12

def untagged ; value end