Class: LIVR::Rules::Modifiers::Remove
- Inherits:
-
LIVR::Rule
- Object
- LIVR::Rule
- LIVR::Rules::Modifiers::Remove
- Defined in:
- lib/livr/rules/modifiers.rb
Instance Method Summary collapse
- #call(value, user_data, field_results) ⇒ Object
-
#initialize(chars) ⇒ Remove
constructor
A new instance of Remove.
Constructor Details
#initialize(chars) ⇒ Remove
Returns a new instance of Remove.
42 43 44 45 |
# File 'lib/livr/rules/modifiers.rb', line 42 def initialize(chars) @chars = chars @re = Regexp.compile("[#{Regexp.quote(@chars)}]") end |
Instance Method Details
#call(value, user_data, field_results) ⇒ Object
47 48 49 50 51 |
# File 'lib/livr/rules/modifiers.rb', line 47 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 |