Class: Object

Inherits:
BasicObject
Defined in:
lib/facets/json.rb,
lib/facets/xoxo.rb

Instance Method Summary collapse

Instance Method Details

#to_jsonObject

Fallback to_json method uses to_yaml, strips the type header and then reloads as a pure hash, which is then converted to JSON.



498
499
500
501
502
# File 'lib/facets/json.rb', line 498

def to_json(*)
  str = to_yaml
  str.sub!(/^---.*?$/, '---')
  YAML.load(str).to_json
end

#to_xoxo(*args) ⇒ Object

Dump object as XOXO.



251
252
253
# File 'lib/facets/xoxo.rb', line 251

def to_xoxo(*args)
  XOXO.dump(self,*args)
end