Class: Prettyrb::Nodes::DstrNode
- Includes:
- StringHelper
- Defined in:
- lib/prettyrb/nodes/dstr_node.rb
Constant Summary collapse
- HEREDOC_TYPE_REGEX =
/<<(.)?/
Instance Method Summary collapse
Methods included from StringHelper
#closing_delimiter, #heredoc?, #heredoc_body, #heredoc_identifier, #heredoc_type, #percent_character, #percent_string?, #start_delimiter
Methods inherited from BaseNode
#initialize, #parent, #string?
Constructor Details
This class inherits a constructor from Prettyrb::Nodes::BaseNode
Instance Method Details
#format ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/prettyrb/nodes/dstr_node.rb', line 8 def format raw_content = loc.expression.source content = raw_content[1...-1] if raw_content[0] == "'" content.gsub('"', '\\"').gsub('#{', '\\#{') else content.gsub("\\", "\\\\") end end |