Class: Jcsv::RBIsElementOf

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(strings) ⇒ RBIsElementOf

Returns a new instance of RBIsElementOf.



121
122
123
124
# File 'lib/constraints.rb', line 121

def initialize(strings)
  @strings = strings
  super()
end

Instance Attribute Details

#stringsObject (readonly)

Returns the value of attribute strings.



119
120
121
# File 'lib/constraints.rb', line 119

def strings
  @strings
end

Instance Method Details

#execute(value, context) ⇒ Object



126
127
128
129
130
131
# File 'lib/constraints.rb', line 126

def execute(value, context)
  validateInputNotNull(value, context)
  raise "Value #{value} not element of #{@strings}:\n#{context}" if
    !@strings.include?(value)
  exec_next(value, context)
end