Class: Jcsv::RBForbidSubstrings
Overview
Instance Attribute Summary collapse
-
#substrings ⇒ Object
readonly
Returns the value of attribute substrings.
Attributes included from NextFilter
Instance Method Summary collapse
- #execute(value, context) ⇒ Object
-
#initialize(substrings) ⇒ RBForbidSubstrings
constructor
A new instance of RBForbidSubstrings.
Methods included from NextFilter
Constructor Details
#initialize(substrings) ⇒ RBForbidSubstrings
Returns a new instance of RBForbidSubstrings.
61 62 63 64 |
# File 'lib/constraints.rb', line 61 def initialize(substrings) @substrings = substrings super() end |
Instance Attribute Details
#substrings ⇒ Object (readonly)
Returns the value of attribute substrings.
59 60 61 |
# File 'lib/constraints.rb', line 59 def substrings @substrings end |
Instance Method Details
#execute(value, context) ⇒ Object
66 67 68 69 70 71 72 |
# File 'lib/constraints.rb', line 66 def execute(value, context) validateInputNotNull(value, context) substrings.each do |sub| raise "Substring #{sub} found in #{value}:\n#{context}" if value.include?(sub) end exec_next(value, context) end |