Class: RubyProf::JsonPrinter
- Inherits:
-
AbstractPrinter
- Object
- AbstractPrinter
- RubyProf::JsonPrinter
- Defined in:
- lib/ruby-prof/json_printer.rb
Instance Attribute Summary collapse
-
#threads ⇒ Object
readonly
Returns the value of attribute threads.
Instance Method Summary collapse
-
#initialize(result) ⇒ JsonPrinter
constructor
A new instance of JsonPrinter.
- #print(output = STDOUT, options = {}) ⇒ Object
Constructor Details
#initialize(result) ⇒ JsonPrinter
Returns a new instance of JsonPrinter.
7 8 9 10 11 12 13 |
# File 'lib/ruby-prof/json_printer.rb', line 7 def initialize(result) super(result) @threads = { :overall_time => 0, # TODO :threads => result.threads.keys.map {|thread_id| thread_info(thread_id) } } end |
Instance Attribute Details
#threads ⇒ Object (readonly)
Returns the value of attribute threads.
6 7 8 |
# File 'lib/ruby-prof/json_printer.rb', line 6 def threads @threads end |
Instance Method Details
#print(output = STDOUT, options = {}) ⇒ Object
15 16 17 |
# File 'lib/ruby-prof/json_printer.rb', line 15 def print(output = STDOUT, = {}) output.puts JSON.pretty_generate(@threads) end |