Class: Unparser::Writer::DynamicString

Inherits:
Object
  • Object
show all
Includes:
Adamantium, Unparser::Writer
Defined in:
lib/unparser/writer/dynamic_string.rb

Constant Summary collapse

PATTERNS_2 =
[
  %i[str_empty begin].freeze,
  %i[begin str_nl].freeze
].freeze
PATTERNS_3 =
[
  %i[begin str_nl_eol str_nl_eol].freeze,
  %i[str_nl_eol begin str_nl_eol].freeze,
  %i[str_ws begin str_nl_eol].freeze
].freeze
FLAT_INTERPOLATION =
%i[ivar cvar gvar nth_ref].to_set.freeze

Constants included from Generation

Generation::EXTRA_NL

Instance Method Summary collapse

Methods included from Unparser::Writer

included

Methods included from Generation

#emit_heredoc_reminders, #symbol_name, #write_to_buffer

Methods included from NodeHelpers

#n, #n?, #s, #unwrap_single_begin

Instance Method Details

#dispatchObject



32
33
34
35
36
37
38
# File 'lib/unparser/writer/dynamic_string.rb', line 32

def dispatch
  if heredoc?
    emit_heredoc_header
  else
    emit_dstr
  end
end

#emit_heredoc_reminderObject



25
26
27
28
29
30
# File 'lib/unparser/writer/dynamic_string.rb', line 25

def emit_heredoc_reminder
  return unless heredoc?

  emit_heredoc_body
  emit_heredoc_footer
end