Module: KDL::StringDumper

Defined in:
lib/kdl/string_dumper.rb

Class Method Summary collapse

Class Method Details

.call(string) ⇒ Object



4
5
6
# File 'lib/kdl/string_dumper.rb', line 4

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

.stringify_identifier(ident) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/kdl/string_dumper.rb', line 8

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