Module: KDL::V1::StringDumper

Extended by:
StringDumper
Includes:
StringDumper
Included in:
StringDumper
Defined in:
lib/kdl/v1/string_dumper.rb

Instance Method Summary collapse

Instance Method Details

#call(string) ⇒ Object



8
9
10
# File 'lib/kdl/v1/string_dumper.rb', line 8

def call(string)
  %("#{string.each_char.map { |char| escape(char) }.join}")
end

#stringify_identifier(ident) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/kdl/v1/string_dumper.rb', line 12

def stringify_identifier(ident)
  if bare_identifier?(ident)
    ident
  else
    call(ident)
  end
end