Module: Normatron::Filters::SqueezeFilter
- Defined in:
- lib/normatron/filters/squeeze_filter.rb
Class Method Summary collapse
-
.evaluate(input, *targets) ⇒ String
Remove multiple occurences of the same character.
Class Method Details
.evaluate(input, *targets) ⇒ String
Remove multiple occurences of the same character. If no option are given, all runs of identical characters are replaced by a single character.
24 25 26 27 |
# File 'lib/normatron/filters/squeeze_filter.rb', line 24 def self.evaluate(input, *targets) return input unless input.kind_of?(String) targets.any? ? input.squeeze(targets.last) : input.squeeze end |