Class: StagingTable::TransferResult
- Inherits:
-
Object
- Object
- StagingTable::TransferResult
- Defined in:
- lib/staging_table/transfer_result.rb
Overview
Holds statistics about a transfer operation
Instance Attribute Summary collapse
-
#inserted ⇒ Object
readonly
Returns the value of attribute inserted.
-
#skipped ⇒ Object
readonly
Returns the value of attribute skipped.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
-
#updated ⇒ Object
readonly
Returns the value of attribute updated.
Instance Method Summary collapse
- #empty? ⇒ Boolean
-
#initialize(inserted: 0, updated: 0, skipped: 0) ⇒ TransferResult
constructor
A new instance of TransferResult.
- #inspect ⇒ Object
- #success? ⇒ Boolean
- #to_h ⇒ Object
Constructor Details
#initialize(inserted: 0, updated: 0, skipped: 0) ⇒ TransferResult
Returns a new instance of TransferResult.
8 9 10 11 12 13 |
# File 'lib/staging_table/transfer_result.rb', line 8 def initialize(inserted: 0, updated: 0, skipped: 0) @inserted = inserted @updated = updated @skipped = skipped @total = inserted + updated + skipped end |
Instance Attribute Details
#inserted ⇒ Object (readonly)
Returns the value of attribute inserted.
6 7 8 |
# File 'lib/staging_table/transfer_result.rb', line 6 def inserted @inserted end |
#skipped ⇒ Object (readonly)
Returns the value of attribute skipped.
6 7 8 |
# File 'lib/staging_table/transfer_result.rb', line 6 def skipped @skipped end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
6 7 8 |
# File 'lib/staging_table/transfer_result.rb', line 6 def total @total end |
#updated ⇒ Object (readonly)
Returns the value of attribute updated.
6 7 8 |
# File 'lib/staging_table/transfer_result.rb', line 6 def updated @updated end |
Instance Method Details
#empty? ⇒ Boolean
28 29 30 |
# File 'lib/staging_table/transfer_result.rb', line 28 def empty? total.zero? end |
#inspect ⇒ Object
32 33 34 |
# File 'lib/staging_table/transfer_result.rb', line 32 def inspect "#<StagingTable::TransferResult inserted=#{inserted} updated=#{updated} skipped=#{skipped} total=#{total}>" end |
#success? ⇒ Boolean
24 25 26 |
# File 'lib/staging_table/transfer_result.rb', line 24 def success? inserted > 0 || updated > 0 end |
#to_h ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/staging_table/transfer_result.rb', line 15 def to_h { inserted: inserted, updated: updated, skipped: skipped, total: total } end |