Class: Tomlrb::StringUtils
- Inherits:
-
Object
- Object
- Tomlrb::StringUtils
- Defined in:
- lib/tomlrb/string_utils.rb
Class Method Summary collapse
- .multiline_replacements(str) ⇒ Object
- .replace_escaped_chars(str) ⇒ Object
- .strip_spaces(str) ⇒ Object
Class Method Details
.multiline_replacements(str) ⇒ Object
4 5 6 |
# File 'lib/tomlrb/string_utils.rb', line 4 def self.multiline_replacements(str) strip_spaces(str).gsub(/\\\n\s+/, '') end |
.replace_escaped_chars(str) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/tomlrb/string_utils.rb', line 8 def self.replace_escaped_chars(str) str .gsub(/\\n/, "\n") .gsub(/\\0/, "\0") .gsub(/\\t/, "\t") .gsub(/\\r/, "\r") .gsub(/\\\"/, '"') .gsub(/\\\\/, '\\') end |
.strip_spaces(str) ⇒ Object
18 19 20 21 |
# File 'lib/tomlrb/string_utils.rb', line 18 def self.strip_spaces(str) str[0] = '' if str[0] == "\n" str end |