Class: LiabilityProof::PrettyPrinter
- Inherits:
-
Object
- Object
- LiabilityProof::PrettyPrinter
- Defined in:
- lib/liability-proof/pretty_printer.rb
Instance Method Summary collapse
-
#initialize(options) ⇒ PrettyPrinter
constructor
A new instance of PrettyPrinter.
- #print ⇒ Object
Constructor Details
#initialize(options) ⇒ PrettyPrinter
Returns a new instance of PrettyPrinter.
4 5 6 7 8 9 |
# File 'lib/liability-proof/pretty_printer.rb', line 4 def initialize() @json_path = .delete(:file) raise ArgumentError, "file to print unspecified" unless @json_path @json = JSON.parse File.read(@json_path) end |
Instance Method Details
#print ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/liability-proof/pretty_printer.rb', line 11 def print if Hash === @json && @json.keys.first == 'partial_tree' print_tree @json['partial_tree'] else ap @json end end |