Class: JsonPrinter
- Inherits:
-
Object
- Object
- JsonPrinter
- Defined in:
- lib/neo4jr-social/json_printer.rb
Overview
Please see github.com/techcrunch/json_printer
Instance Attribute Summary collapse
-
#buf ⇒ Object
readonly
Returns the value of attribute buf.
-
#indent ⇒ Object
readonly
Returns the value of attribute indent.
Class Method Summary collapse
-
.render(obj) ⇒ Object
Arguments obj<Object>:: The object to be rendered into JSON.
- .render_html(obj) ⇒ Object
Instance Attribute Details
#buf ⇒ Object (readonly)
Returns the value of attribute buf.
4 5 6 |
# File 'lib/neo4jr-social/json_printer.rb', line 4 def buf @buf end |
#indent ⇒ Object (readonly)
Returns the value of attribute indent.
4 5 6 |
# File 'lib/neo4jr-social/json_printer.rb', line 4 def indent @indent end |
Class Method Details
.render(obj) ⇒ Object
Arguments
- obj<Object>
-
The object to be rendered into JSON. This object and all of its associated objects must be either nil, true, false, a String, a Symbol, a Numeric, an Array, or a Hash.
Returns
- <String>
-
The pretty-printed JSON ecoding of the given obj. This string can be parsed by any compliant JSON parser without modification.
Examples
See JsonPrinter
docs.
20 21 22 |
# File 'lib/neo4jr-social/json_printer.rb', line 20 def self.render(obj) new(obj).buf end |
.render_html(obj) ⇒ Object
24 25 26 |
# File 'lib/neo4jr-social/json_printer.rb', line 24 def self.render_html(obj) render(obj).gsub(' ', ' ').gsub("\n", "<br>") end |