Class: Relisp::String

Inherits:
Object show all
Defined in:
lib/relisp/type_conversion/programming_types.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_elisp(object) ⇒ Object



268
269
270
# File 'lib/relisp/type_conversion/programming_types.rb', line 268

def self.from_elisp(object)
  new(eval(object[:string]))
end

Instance Method Details

#to_elispObject



272
273
274
275
# File 'lib/relisp/type_conversion/programming_types.rb', line 272

def to_elisp
  # convert "\u{0000}" to "\u0000"
  self.dump.gsub(/\\u\{([0-9a-e]+)\}/) { |m| sprintf("\\u%04x", $1.to_i(16)) }
end