class Sexpistol
Constants
- VERSION
Public Class Methods
parse(string, parse_ruby_keyword_literals: false)
click to toggle source
# File lib/sexpistol.rb, line 9 def parse(string, parse_ruby_keyword_literals: false) Sexpistol::Parser.new(string, parse_ruby_keyword_literals).parse end
to_sexp(data, scheme_compatability: false)
click to toggle source
# File lib/sexpistol.rb, line 13 def to_sexp(data, scheme_compatability: false) data = convert_scheme_literals(data) if scheme_compatability return "\"#{data}\"" if data.is_a?(String) return data.to_s unless data.is_a?(Array) if data.is_a?(SExpressionArray) data.map { |x| to_sexp(x, scheme_compatability: scheme_compatability) }.join(' ') else "(#{data.map { |x| to_sexp(x, scheme_compatability: scheme_compatability) }.join(' ')})" end end
Private Class Methods
convert_scheme_literals(data)
click to toggle source
# File lib/sexpistol.rb, line 28 def convert_scheme_literals(data) case data when nil then [] when true then :'#t' when false then :'#f' else data end end