Class: PostgresUpsert::Result
- Inherits:
-
Object
- Object
- PostgresUpsert::Result
- Defined in:
- lib/postgres_upsert/result.rb
Instance Attribute Summary collapse
-
#inserted ⇒ Object
readonly
Returns the value of attribute inserted.
-
#updated ⇒ Object
readonly
Returns the value of attribute updated.
Instance Method Summary collapse
- #changed_rows ⇒ Object
- #copied_rows ⇒ Object
-
#initialize(insert_result, update_result, copy_result) ⇒ Result
constructor
A new instance of Result.
- #updated_rows ⇒ Object
Constructor Details
#initialize(insert_result, update_result, copy_result) ⇒ Result
Returns a new instance of Result.
5 6 7 8 9 |
# File 'lib/postgres_upsert/result.rb', line 5 def initialize(insert_result, update_result, copy_result) @inserted = insert_result ? insert_result.cmd_tuples : 0 @updated = update_result ? update_result.cmd_tuples : 0 @copied = copy_result ? copy_result.cmd_tuples : 0 end |
Instance Attribute Details
#inserted ⇒ Object (readonly)
Returns the value of attribute inserted.
3 4 5 |
# File 'lib/postgres_upsert/result.rb', line 3 def inserted @inserted end |
#updated ⇒ Object (readonly)
Returns the value of attribute updated.
3 4 5 |
# File 'lib/postgres_upsert/result.rb', line 3 def updated @updated end |
Instance Method Details
#changed_rows ⇒ Object
11 12 13 |
# File 'lib/postgres_upsert/result.rb', line 11 def changed_rows @inserted + @updated end |
#copied_rows ⇒ Object
15 16 17 |
# File 'lib/postgres_upsert/result.rb', line 15 def copied_rows @copied end |
#updated_rows ⇒ Object
19 20 21 |
# File 'lib/postgres_upsert/result.rb', line 19 def updated_rows @updated end |