Class: Excelsieur::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/excelsieur/result.rb

Defined Under Namespace

Modules: Statuses

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(total_rows) ⇒ Result

Returns a new instance of Result.



13
14
15
16
17
18
19
# File 'lib/excelsieur/result.rb', line 13

def initialize(total_rows)
  self.errors = {
    missing_column: [],
    model: []
  }
  self.report = Report.new(total_rows)
end

Instance Attribute Details

#errorsObject

Returns the value of attribute errors.



11
12
13
# File 'lib/excelsieur/result.rb', line 11

def errors
  @errors
end

#reportObject

Returns the value of attribute report.



11
12
13
# File 'lib/excelsieur/result.rb', line 11

def report
  @report
end

Instance Method Details

#failed?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/excelsieur/result.rb', line 31

def failed?
  status == Result::Statuses::FAILED
end

#statusObject



21
22
23
24
25
26
27
28
29
# File 'lib/excelsieur/result.rb', line 21

def status
  return Statuses::FAILED if errors[:missing_column].any? || errors[:model].any?

  if report.done?
    Statuses::SUCCEEDED
  else
    Statuses::PENDING
  end
end