Class: NTable::IndexWrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/ntable/index_wrapper.rb

Overview

Use one of these in a coordinate to force the coordinate to be treated as an index rather than a label.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(val_) ⇒ IndexWrapper

Create an IndexWrapper with the given integer index



48
49
50
# File 'lib/ntable/index_wrapper.rb', line 48

def initialize(val_)
  @value = val_.to_i
end

Instance Attribute Details

#valueObject (readonly) Also known as: to_i

Retrieve the actual index



70
71
72
# File 'lib/ntable/index_wrapper.rb', line 70

def value
  @value
end

Instance Method Details

#eql?(rhs_) ⇒ Boolean Also known as: ==

Standard equality checker

Returns:

  • (Boolean)


55
56
57
# File 'lib/ntable/index_wrapper.rb', line 55

def eql?(rhs_)
  rhs_.is_a?(IndexWrapper) && @value == @rhs_.value
end

#hashObject

Standard hash value



63
64
65
# File 'lib/ntable/index_wrapper.rb', line 63

def hash
  @value.hash
end