Class: AbstractImporter::Summary

Inherits:
Struct
  • Object
show all
Defined in:
lib/abstract_importer/summary.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0) ⇒ Summary

Returns a new instance of Summary.



4
5
6
# File 'lib/abstract_importer/summary.rb', line 4

def initialize(a=0, b=0, c=0, d=0, e=0, f=0, g=0)
  super(a,b,c,d,e,f,g)
end

Instance Attribute Details

#already_importedObject

Returns the value of attribute already_imported

Returns:

  • (Object)

    the current value of already_imported



2
3
4
# File 'lib/abstract_importer/summary.rb', line 2

def already_imported
  @already_imported
end

#createdObject

Returns the value of attribute created

Returns:

  • (Object)

    the current value of created



2
3
4
# File 'lib/abstract_importer/summary.rb', line 2

def created
  @created
end

#invalidObject

Returns the value of attribute invalid

Returns:

  • (Object)

    the current value of invalid



2
3
4
# File 'lib/abstract_importer/summary.rb', line 2

def invalid
  @invalid
end

#msObject

Returns the value of attribute ms

Returns:

  • (Object)

    the current value of ms



2
3
4
# File 'lib/abstract_importer/summary.rb', line 2

def ms
  @ms
end

#redundantObject

Returns the value of attribute redundant

Returns:

  • (Object)

    the current value of redundant



2
3
4
# File 'lib/abstract_importer/summary.rb', line 2

def redundant
  @redundant
end

#skippedObject

Returns the value of attribute skipped

Returns:

  • (Object)

    the current value of skipped



2
3
4
# File 'lib/abstract_importer/summary.rb', line 2

def skipped
  @skipped
end

#totalObject

Returns the value of attribute total

Returns:

  • (Object)

    the current value of total



2
3
4
# File 'lib/abstract_importer/summary.rb', line 2

def total
  @total
end

Instance Method Details

#+(other) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/abstract_importer/summary.rb', line 13

def +(other)
  Summary.new(
    total + other.total,
    redundant + other.redundant,
    created + other.created,
    already_imported + other.already_imported,
    invalid + other.invalid,
    ms + other.ms,
    skipped + other.skipped)
end

#average_msObject



8
9
10
11
# File 'lib/abstract_importer/summary.rb', line 8

def average_ms
  return nil if total == 0
  ms / total
end