Class: Pal::Operation::EvaluationContext

Inherits:
Object
  • Object
show all
Defined in:
lib/pal/operation/filter_evaluator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(row, column_headers) ⇒ EvaluationContext

Returns a new instance of EvaluationContext.



238
239
240
241
# File 'lib/pal/operation/filter_evaluator.rb', line 238

def initialize(row, column_headers)
  @row = row
  @column_headers = column_headers
end

Instance Attribute Details

#column_headersObject

Returns the value of attribute column_headers.



236
237
238
# File 'lib/pal/operation/filter_evaluator.rb', line 236

def column_headers
  @column_headers
end

#rowObject

Returns the value of attribute row.



236
237
238
# File 'lib/pal/operation/filter_evaluator.rb', line 236

def row
  @row
end

Instance Method Details

#get_value(key) ⇒ Object



243
244
245
246
# File 'lib/pal/operation/filter_evaluator.rb', line 243

def get_value(key)
  idx = @column_headers.fetch(key, -1)
  idx.zero? || idx.positive? ? @row[idx] : nil
end