Module: Nodaire
- Defined in:
- lib/nodaire/base.rb,
lib/nodaire/util.rb,
lib/nodaire/lexer.rb,
lib/nodaire/errors.rb
Overview
Nodaire is a collection of text file parsers.
Defined Under Namespace
Classes: Indental, Lexer, Parser, ParserError, Tablatal
Constant Summary collapse
- VERSION =
The version number.
'0.5.0'
- DATE =
The date when this version was released.
'2019-08-26'
Class Method Summary collapse
-
.squeeze(string) ⇒ String
Normalize the whitespace in a string.
-
.symbolize(string) ⇒ Symbol
Convert a string into a normalized symbol.
Class Method Details
.squeeze(string) ⇒ String
Normalize the whitespace in a string.
This strips the string and replaces each sequence of whitespace with a single space.
17 18 19 |
# File 'lib/nodaire/util.rb', line 17 def self.squeeze(string) (string || '').gsub(/\s+/, ' ').strip end |
.symbolize(string) ⇒ Symbol
Convert a string into a normalized symbol.
This converts to lower case and replaces each sequence of non-alphanumeric characters with an underscore.
32 33 34 |
# File 'lib/nodaire/util.rb', line 32 def self.symbolize(string) squeeze(string).downcase.gsub(/[^a-z0-9]+/, '_').to_sym end |