Class: LIVR::Rules::Modifiers::LeaveOnly
- Inherits:
-
LIVR::Rule
- Object
- LIVR::Rule
- LIVR::Rules::Modifiers::LeaveOnly
- Defined in:
- lib/livr/rules/modifiers.rb
Instance Method Summary collapse
- #call(value, user_data, field_results) ⇒ Object
-
#initialize(chars) ⇒ LeaveOnly
constructor
A new instance of LeaveOnly.
Constructor Details
#initialize(chars) ⇒ LeaveOnly
Returns a new instance of LeaveOnly.
55 56 57 58 |
# File 'lib/livr/rules/modifiers.rb', line 55 def initialize(chars) @chars = chars @re = Regexp.compile("[^#{Regexp.quote(@chars)}]") end |
Instance Method Details
#call(value, user_data, field_results) ⇒ Object
60 61 62 63 64 |
# File 'lib/livr/rules/modifiers.rb', line 60 def call(value, user_data, field_results) return if is_no_value(value) || value.is_a?(Hash) field_results << value.to_s.gsub(@re, '') return end |