Class: Rulix::Mutators::SqueezeSpaces

Inherits:
Object
  • Object
show all
Defined in:
lib/rulix/mutators/squeeze_spaces.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.to_procObject



4
5
6
# File 'lib/rulix/mutators/squeeze_spaces.rb', line 4

def self.to_proc
  new.method(:call)
end

Instance Method Details

#call(string) ⇒ Object

Raises:

  • (ArgumentError)


8
9
10
11
12
# File 'lib/rulix/mutators/squeeze_spaces.rb', line 8

def call string
  raise ArgumentError, "argument is not a string" unless string.is_a? String
  
  string.squeeze ' '
end