Class: Arrow::Slicer

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

Defined Under Namespace

Modules: Helper Classes: AndCondition, ColumnCondition, Condition, EqualCondition, GreaterCondition, GreaterEqualCondition, InCondition, LessCondition, LessEqualCondition, LogicalCondition, MatchSubstringFamilyCondition, NotColumnCondition, NotEqualCondition, NotInCondition, OrCondition, RejectCondition, SelectCondition, XorCondition

Instance Method Summary collapse

Constructor Details

#initialize(table) ⇒ Slicer

Returns a new instance of Slicer.



20
21
22
# File 'lib/arrow/slicer.rb', line 20

def initialize(table)
  @table = table
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



35
36
37
38
39
40
41
# File 'lib/arrow/slicer.rb', line 35

def method_missing(name, *args, &block)
  if args.empty?
    column_condition = self[name]
    return column_condition if column_condition
  end
  super
end

Instance Method Details

#[](column_name) ⇒ Object



24
25
26
27
28
# File 'lib/arrow/slicer.rb', line 24

def [](column_name)
  column = @table[column_name]
  return nil if column.nil?
  ColumnCondition.new(column)
end

#respond_to_missing?(name, include_private) ⇒ Boolean

Returns:

  • (Boolean)


30
31
32
33
# File 'lib/arrow/slicer.rb', line 30

def respond_to_missing?(name, include_private)
  return true if self[name]
  super
end