Sha256: e4d5dbf36bda5c5d7cfe69eef46947e6a93ff5a32ef4b71e70715b02967ccad9

Contents?: true

Size: 446 Bytes

Versions: 12

Compression:

Stored size: 446 Bytes

Contents

module Tomlrb
  class StringUtils

    def self.multiline_replacements(str)
      strip_spaces(str).gsub(/\\\n\s+/, '')
    end

    def self.replace_escaped_chars(str)
      str
        .gsub(/\\n/, "\n")
        .gsub(/\\0/, "\0")
        .gsub(/\\t/, "\t")
        .gsub(/\\r/, "\r")
        .gsub(/\\\"/, '"')
        .gsub(/\\\\/, '\\')
    end

    def self.strip_spaces(str)
      str[0] = '' if str[0] == "\n"
      str
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
tomlrb-1.2.5 lib/tomlrb/string_utils.rb
tomlrb-1.2.4 lib/tomlrb/string_utils.rb
tomlrb-1.2.3 lib/tomlrb/string_utils.rb
tomlrb-1.2.2 lib/tomlrb/string_utils.rb
tomlrb-1.2.1 lib/tomlrb/string_utils.rb
tomlrb-1.2.0 lib/tomlrb/string_utils.rb
tomlrb-1.1.3 lib/tomlrb/string_utils.rb
tomlrb-1.1.1 lib/tomlrb/string_utils.rb
tomlrb-1.1.0 lib/tomlrb/string_utils.rb
tomlrb-1.0.3 lib/tomlrb/string_utils.rb
tomlrb-1.0.2 lib/tomlrb/string_utils.rb
tomlrb-1.0.1 lib/tomlrb/string_utils.rb