module Nomener::Base

Module of constants, methods being used in other modules and classes

Constants

PERIOD

probably unnecessary constant

Public Instance Methods

dustoff(str) click to toggle source

Internal: a softer clean we keep re-using

str - the string to dust off

Returns the nice clean

# File lib/nomener/base.rb, line 12
def dustoff(str)
  str = str.gsub PERIOD, ' '
  str = str.squeeze ' '
  str.strip
end
gut!(str = '', pattern = / /) click to toggle source

Internal: clean out a given string with a given pattern

Modfies the given string

str - the string to gut pattern - the regext to cut with

Returns the gutted pattern

# File lib/nomener/base.rb, line 25
def gut!(str = '', pattern = / /)
  found = []
  str.gsub! pattern do |pat|
    found << pat.strip
    ''
  end
  found.join ' '
end