class Elparser::SExpString

Attributes

str[R]

Public Class Methods

new(str) click to toggle source
# File lib/elparser.rb, line 64
def initialize(str)
  @str = str
end

Public Instance Methods

to_ruby() click to toggle source
# File lib/elparser.rb, line 78
def to_ruby
  @str
end
to_s() click to toggle source
# File lib/elparser.rb, line 67
def to_s
  # replace unicode point escape syntax : \u{xxxx} -> \uxxxx, \u{yyyyy} -> \U000yyyyy
  @str.dump.gsub(/\\u\{(\h{4,6})\}/) do |m|
    i = $1
    if i.size == 4 then
      "\\u#{i}"
    else
      "\\U00%06x"%(i.hex)
    end
  end
end