Class: Mdq::OutputBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/mdq/output_builder.rb

Overview

OutputBuilder

Instance Method Summary collapse

Constructor Details

#initializeOutputBuilder

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

#clearObject



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

def clear
  @result = []
end


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