Class: Jcsv::RBStrConstraints
Overview
Instance Attribute Summary
Attributes included from NextFilter
Instance Method Summary collapse
- #execute(value, context) ⇒ Object
-
#initialize(function, *args, check: true) ⇒ RBStrConstraints
constructor
A new instance of RBStrConstraints.
Methods included from NextFilter
Constructor Details
#initialize(function, *args, check: true) ⇒ RBStrConstraints
Returns a new instance of RBStrConstraints.
141 142 143 144 145 146 |
# File 'lib/constraints.rb', line 141 def initialize(function, *args, check: true) @function = function @args = args @check = check super() end |
Instance Method Details
#execute(value, context) ⇒ Object
148 149 150 151 152 153 |
# File 'lib/constraints.rb', line 148 def execute(value, context) truth = value.send(@function, *(@args)) raise "Constraint #{@function} with value #{value} is #{truth}:\n#{context}" if truth == @check exec_next(value, context) end |