Class: PJson

Inherits:
Object
  • Object
show all
Includes:
Pygments
Defined in:
lib/pjson.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#jsonObject

Returns the value of attribute json.



7
8
9
# File 'lib/pjson.rb', line 7

def json
  @json
end

Instance Method Details

#to_sObject



13
14
15
# File 'lib/pjson.rb', line 13

def to_s
  Lexer.find_by_name('JSON').highlight(@json, { formatter: 'terminal' })
end