Sha256: 55bf88252057633e93fe1e89bf33bc0832ea41e3c08a44e7bac5d036f5bbfc5b
Contents?: true
Size: 715 Bytes
Versions: 3
Compression:
Stored size: 715 Bytes
Contents
class Object def to_sxp to_s.to_json end end class NilClass def to_sxp; '#n'; end end class FalseClass def to_sxp; '#f'; end end class TrueClass def to_sxp; '#t'; end end class String def to_sxp; inspect; end end class Symbol def to_sxp; to_s; end end class Integer def to_sxp; to_s; end end class Float def to_sxp case when nan? then 'nan.' when infinite? then (infinite? > 0 ? '+inf.' : '-inf.') else to_s end end end class Array def to_sxp '(' << map { |x| x.to_sxp }.join(' ') << ')' end end class Time def to_sxp '#@' << (respond_to?(:xmlschema) ? xmlschema : to_i).to_s end end class Regexp def to_sxp '#' << inspect end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
sxp-0.0.3 | lib/sxp/writer.rb |
sxp-0.0.2 | lib/sxp/writer.rb |
sxp-0.0.1 | lib/sxp/writer.rb |