Class: Arrow::Slicer::RejectCondition

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

Instance Method Summary collapse

Methods inherited from Condition

#&, #^, #|

Constructor Details

#initialize(column, block) ⇒ RejectCondition

Returns a new instance of RejectCondition.



367
368
369
370
# File 'lib/arrow/slicer.rb', line 367

def initialize(column, block)
  @column = column
  @block = block
end

Instance Method Details

#!@Object



372
373
374
# File 'lib/arrow/slicer.rb', line 372

def !@
  SelectCondition.new(@column, @block)
end

#evaluateObject



376
377
378
379
380
381
382
383
384
385
386
# File 'lib/arrow/slicer.rb', line 376

def evaluate
  raw_array = @column.collect do |value|
    evaluated_value = @block.call(value)
    if evaluated_value.nil?
      nil
    else
      not evaluated_value
    end
  end
  BooleanArray.new(raw_array)
end