Class: Dragnet::Exporters::Exporter

Inherits:
Object
  • Object
show all
Defined in:
lib/dragnet/exporters/exporter.rb

Overview

Base class for all exporter classes.

Direct Known Subclasses

HTMLExporter, JSONExporter

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(test_records:, errors:, repository:, logger:) ⇒ Exporter

Returns a new instance of Exporter.

Parameters:

  • test_records (Array<Hash>)

    The array of test records.

  • errors (Array<Hash>)

    The array of errors.

  • repository (Dragnet::Repository, Dragnet::MultiRepository)

    The repository where the MTR files and the source code are stored.

  • logger (#info)

    A logger object to use for output.



14
15
16
17
18
19
# File 'lib/dragnet/exporters/exporter.rb', line 14

def initialize(test_records:, errors:, repository:, logger:)
  @test_records = test_records
  @errors = errors
  @repository = repository
  @logger = logger
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



7
8
9
# File 'lib/dragnet/exporters/exporter.rb', line 7

def errors
  @errors
end

#loggerObject (readonly)

Returns the value of attribute logger.



7
8
9
# File 'lib/dragnet/exporters/exporter.rb', line 7

def logger
  @logger
end

#repositoryObject (readonly)

Returns the value of attribute repository.



7
8
9
# File 'lib/dragnet/exporters/exporter.rb', line 7

def repository
  @repository
end

#test_recordsObject (readonly)

Returns the value of attribute test_records.



7
8
9
# File 'lib/dragnet/exporters/exporter.rb', line 7

def test_records
  @test_records
end

Instance Method Details

#exportObject

Raises:

  • (NotImplementedError)

    Is always raised. Subclasses are expected to override this method.



23
24
25
26
# File 'lib/dragnet/exporters/exporter.rb', line 23

def export
  raise NotImplementedError,
        "'export' method not implemented for class #{self.class}"
end