Class: Arrow::Slicer::MatchSubstringFamilyCondition

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

Instance Method Summary collapse

Methods inherited from Condition

#&, #^, #|

Constructor Details

#initialize(function, column, pattern, ignore_case, invert: false) ⇒ MatchSubstringFamilyCondition

Returns a new instance of MatchSubstringFamilyCondition.



390
391
392
393
394
395
396
397
# File 'lib/arrow/slicer.rb', line 390

def initialize(function, column, pattern, ignore_case, invert: false)
  @function = function
  @column = column
  @options = MatchSubstringOptions.new
  @options.pattern = pattern
  @options.ignore_case = ignore_case
  @invert = invert
end

Instance Method Details

#!@Object



399
400
401
402
403
404
405
# File 'lib/arrow/slicer.rb', line 399

def !@
  MatchSubstringFamilyCondition.new(@function,
                                    @column,
                                    @options.pattern,
                                    @options.ignore_case?,
                                    invert: !@invert)
end

#evaluateObject



407
408
409
410
411
412
413
# File 'lib/arrow/slicer.rb', line 407

def evaluate
  datum = Function.find(@function).execute([@column.data], @options)
  if @invert
    datum = Function.find("invert").execute([datum])
  end
  datum.value
end