class String

Special version of strip methods to remove special white spaces

Public Instance Methods

super_lstrip() click to toggle source
# File lib/super_strip.rb, line 5
def super_lstrip
  split('').drop_while do |point|
    SuperStrip::WHITE_SPACES.include?(point)
  end.join
end
super_lstrip!() click to toggle source
# File lib/super_strip.rb, line 19
def super_lstrip!
  do_change(:super_lstrip)
end
super_rstrip() click to toggle source
# File lib/super_strip.rb, line 11
def super_rstrip
  reverse.super_lstrip.reverse
end
super_rstrip!() click to toggle source
# File lib/super_strip.rb, line 23
def super_rstrip!
  do_change(:super_rstrip)
end
super_strip() click to toggle source
# File lib/super_strip.rb, line 15
def super_strip
  super_lstrip.super_rstrip
end
super_strip!() click to toggle source
# File lib/super_strip.rb, line 27
def super_strip!
  do_change(:super_strip)
end

Private Instance Methods

do_change(method) click to toggle source
# File lib/super_strip.rb, line 33
def do_change(method)
  after = send(method)
  changed = self != after
  replace(after)
  self if changed
end