Module: Normatron::Filters::SqueezeFilter
- Defined in:
- lib/normatron/filters/squeeze_filter.rb
Overview
Remove multiple occurences of the same character.
If no option are given, all runs of identical characters are replaced by a single character.
Class Method Summary collapse
-
.call(input, *targets) ⇒ String
Performs input conversion according to filter requirements.
Class Method Details
.call(input, *targets) ⇒ String
Performs input conversion according to filter requirements.
This method returns the object itself when the first argument is not a String.
32 33 34 35 |
# File 'lib/normatron/filters/squeeze_filter.rb', line 32 def self.call(input, *targets) return input unless input.kind_of?(String) targets.any? ? input.squeeze(targets.last) : input.squeeze end |