Class: PJson
Instance Attribute Summary collapse
-
#json ⇒ Object
Returns the value of attribute json.
Instance Method Summary collapse
-
#initialize(json) ⇒ PJson
constructor
A new instance of PJson.
- #to_s ⇒ Object
Constructor Details
#initialize(json) ⇒ PJson
Returns a new instance of PJson.
9 10 11 |
# File 'lib/pjson.rb', line 9 def initialize(json) @json = JSON.pretty_generate(JSON.load(json)) end |
Instance Attribute Details
#json ⇒ Object
Returns the value of attribute json.
7 8 9 |
# File 'lib/pjson.rb', line 7 def json @json end |
Instance Method Details
#to_s ⇒ Object
13 14 15 |
# File 'lib/pjson.rb', line 13 def to_s Lexer.find_by_name('JSON').highlight(@json, { formatter: 'terminal' }) end |