Class: Seedie::Reporters::BaseReporter

Inherits:
Object
  • Object
show all
Defined in:
lib/seedie/reporters/base_reporter.rb

Direct Known Subclasses

ConsoleReporter

Constant Summary collapse

INDENT_SIZE =
2

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(output = nil) ⇒ BaseReporter

Returns a new instance of BaseReporter.



10
11
12
13
14
# File 'lib/seedie/reporters/base_reporter.rb', line 10

def initialize(output = nil)
  @output = output || StringIO.new
  @reports = []
  @indent_level = 0
end

Instance Attribute Details

#outputObject (readonly)

Returns the value of attribute output.



8
9
10
# File 'lib/seedie/reporters/base_reporter.rb', line 8

def output
  @output
end

#reportsObject (readonly)

Returns the value of attribute reports.



8
9
10
# File 'lib/seedie/reporters/base_reporter.rb', line 8

def reports
  @reports
end

Instance Method Details

#closeObject



20
21
22
23
24
# File 'lib/seedie/reporters/base_reporter.rb', line 20

def close
  return if output.closed?

  output.flush
end

#update(event_type, options) ⇒ Object

Raises:

  • (NotImplementedError)


16
17
18
# File 'lib/seedie/reporters/base_reporter.rb', line 16

def update(event_type, options)
  raise NotImplementedError, "Subclasses must define 'update'."
end