Class: Uniword::Batch::Operation::FileResult

Inherits:
Object
  • Object
show all
Defined in:
lib/uniword/batch/operation/file_result.rb

Overview

Aggregated result for one file in a batch run.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path:, status:, metric: 0, error: nil) ⇒ FileResult

Returns a new instance of FileResult.

Parameters:

  • path (String)
  • status (Symbol)
  • metric (Integer) (defaults to: 0)
  • error (String, nil) (defaults to: nil)


25
26
27
28
29
30
# File 'lib/uniword/batch/operation/file_result.rb', line 25

def initialize(path:, status:, metric: 0, error: nil)
  @path = path
  @status = status
  @metric = metric
  @error = error
end

Instance Attribute Details

#errorString? (readonly)

Returns error message when status is :failure.

Returns:

  • (String, nil)

    error message when status is :failure



19
20
21
# File 'lib/uniword/batch/operation/file_result.rb', line 19

def error
  @error
end

#metricInteger (readonly)

Returns operation-specific metric (e.g. repair count, verify issue count).

Returns:

  • (Integer)

    operation-specific metric (e.g. repair count, verify issue count)



16
17
18
# File 'lib/uniword/batch/operation/file_result.rb', line 16

def metric
  @metric
end

#pathString (readonly)

Returns absolute or relative path of the input file.

Returns:

  • (String)

    absolute or relative path of the input file



9
10
11
# File 'lib/uniword/batch/operation/file_result.rb', line 9

def path
  @path
end

#statusSymbol (readonly)

Returns :success, :failure.

Returns:

  • (Symbol)

    :success, :failure



12
13
14
# File 'lib/uniword/batch/operation/file_result.rb', line 12

def status
  @status
end

Instance Method Details

#success?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/uniword/batch/operation/file_result.rb', line 33

def success?
  @status == :success
end