Class: Namo::Row

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

Instance Method Summary collapse

Instance Method Details

#[](name) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/namo.rb', line 8

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

#match?(selections) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
19
20
21
22
23
24
25
# File 'lib/namo.rb', line 16

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



27
28
29
# File 'lib/namo.rb', line 27

def to_h
  @row
end