Class: Prettyrb::Nodes::StrNode
- Includes:
- StringHelper
- Defined in:
- lib/prettyrb/nodes/str_node.rb
Constant Summary
Constants included from StringHelper
Prettyrb::Nodes::StringHelper::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
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/prettyrb/nodes/str_node.rb', line 6 def format raw_content = loc.expression.source content = raw_content[1...-1] if raw_content[0] == "'" content.gsub('"', '\\"').gsub('#{', '\\#{') else content.gsub("\\", "\\\\") end end |