Class: Mdq::OutputBuilder
- Inherits:
-
Object
- Object
- Mdq::OutputBuilder
- Defined in:
- lib/mdq/output_builder.rb
Overview
OutputBuilder
Instance Method Summary collapse
- #add(new_result) ⇒ Object
- #clear ⇒ Object
-
#initialize ⇒ OutputBuilder
constructor
A new instance of OutputBuilder.
- #print ⇒ Object
Constructor Details
#initialize ⇒ OutputBuilder
Returns a new instance of OutputBuilder.
9 10 11 |
# File 'lib/mdq/output_builder.rb', line 9 def initialize @result = [] end |
Instance Method Details
#add(new_result) ⇒ Object
17 18 19 |
# File 'lib/mdq/output_builder.rb', line 17 def add(new_result) @result << new_result end |
#clear ⇒ Object
13 14 15 |
# File 'lib/mdq/output_builder.rb', line 13 def clear @result = [] end |
#print ⇒ Object
21 22 23 24 25 |
# File 'lib/mdq/output_builder.rb', line 21 def print return if @result == [] puts JSON.pretty_generate(@result.as_json) end |