Sha256: 420d6aa902ed39a672b848647113eb844a14dbd383bfddc67a16a62abdbd317a

Contents?: true

Size: 365 Bytes

Versions: 2

Compression:

Stored size: 365 Bytes

Contents

module Prettyrb
  module Nodes
    class StrNode < BaseNode
      include StringHelper

      def format
        raw_content = loc.expression.source
        content = raw_content[1...-1]

        if raw_content[0] == "'"
          content.gsub('"', '\\"').gsub('#{', '\\#{')
        else
          content.gsub("\\", "\\\\")
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
prettyrb-0.5.0 lib/prettyrb/nodes/str_node.rb
prettyrb-0.4.0 lib/prettyrb/nodes/str_node.rb