Class: Namo::Row

Inherits:
Object
  • Object
show all
Defined in:
lib/Namo/Row.rb

Instance Method Summary collapse

Instance Method Details

#[](name) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/Namo/Row.rb', line 6

def [](name)
  if @formulae.key?(name)
    @formulae[name].call(self)
  else
    @row[name]
  end
end

#match?(selections) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
17
18
19
20
21
22
23
# File 'lib/Namo/Row.rb', line 14

def match?(selections)
  selections.all? do |dimension, coordinate|
    case coordinate
    when Array, Range
      coordinate.include?(self[dimension])
    else
      self[dimension] == coordinate
    end
  end
end

#to_hObject



25
26
27
# File 'lib/Namo/Row.rb', line 25

def to_h
  @row
end