Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/facets/json.rb,
lib/facets/xoxo.rb
Instance Method Summary collapse
-
#to_json ⇒ Object
Fallback to_json method uses to_yaml, strips the type header and then reloads as a pure hash, which is then converted to JSON.
-
#to_xoxo(*args) ⇒ Object
Dump object as XOXO.
Instance Method Details
#to_json ⇒ Object
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 |