Class: Jcsv::RBEquals

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

Overview

Instance Attribute Summary collapse

Attributes included from NextFilter

#last_filter, #next_filter

Instance Method Summary collapse

Methods included from NextFilter

#>>, #exec_next

Constructor Details

#initialize(value = nil) ⇒ RBEquals

Returns a new instance of RBEquals.



84
85
86
87
# File 'lib/constraints.rb', line 84

def initialize(value = nil)
  @value = value
  super()
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



82
83
84
# File 'lib/constraints.rb', line 82

def value
  @value
end

Instance Method Details

#execute(value, context) ⇒ Object



89
90
91
92
93
94
95
96
# File 'lib/constraints.rb', line 89

def execute(value, context)
  validateInputNotNull(value, context)
  @value ||= value # if value not initialized then use the first read value for equals
  
  raise "Value '#{value}' is not equal to '#{@value}':\n#{context}" if
    (value != @value)
  exec_next(value, context)
end