module Nodaire
Nodaire
is a collection of text file parsers.
@author Liam Cooke
Constants
- DATE
The date when this version was released.
- VERSION
The version number.
Public Class Methods
squeeze(string)
click to toggle source
Normalize the whitespace in a string.
This strips the string and replaces each sequence of whitespace with a single space.
@param [String] string
@since 0.4.0 @return [String]
# File lib/nodaire/util.rb, line 17 def self.squeeze(string) (string || '').gsub(/\s+/, ' ').strip end
symbolize(string)
click to toggle source
Convert a string into a normalized symbol.
This converts to lower case and replaces each sequence of non-alphanumeric characters with an underscore.
@param [String] string
@since 0.4.0 @return [Symbol]
# File lib/nodaire/util.rb, line 32 def self.symbolize(string) squeeze(string).downcase.gsub(/[^a-z0-9]+/, '_').to_sym end