Class: DataShift::FailureData
- Inherits:
-
Object
- Object
- DataShift::FailureData
- Defined in:
- lib/datashift/loaders/failure_data.rb
Instance Attribute Summary collapse
-
#error_messages ⇒ Object
Returns the value of attribute error_messages.
-
#load_object ⇒ Object
Returns the value of attribute load_object.
-
#node_context ⇒ Object
Returns the value of attribute node_context.
Instance Method Summary collapse
- #destroy_failed_object ⇒ Object
- #errors ⇒ Object
-
#initialize(load_object, node_context, error_messages = []) ⇒ FailureData
constructor
The database object, and the inbound context that failed.
Constructor Details
#initialize(load_object, node_context, error_messages = []) ⇒ FailureData
The database object, and the inbound context that failed
18 19 20 21 22 23 24 25 26 |
# File 'lib/datashift/loaders/failure_data.rb', line 18 def initialize(load_object, node_context, = []) @load_object = load_object @node_context = node_context @error_messages = [*] @error_messages += load_object.errors. if(load_object) @error_messages.uniq! end |
Instance Attribute Details
#error_messages ⇒ Object
Returns the value of attribute error_messages.
15 16 17 |
# File 'lib/datashift/loaders/failure_data.rb', line 15 def @error_messages end |
#load_object ⇒ Object
Returns the value of attribute load_object.
12 13 14 |
# File 'lib/datashift/loaders/failure_data.rb', line 12 def load_object @load_object end |
#node_context ⇒ Object
Returns the value of attribute node_context.
13 14 15 |
# File 'lib/datashift/loaders/failure_data.rb', line 13 def node_context @node_context end |
Instance Method Details
#destroy_failed_object ⇒ Object
32 33 34 35 36 |
# File 'lib/datashift/loaders/failure_data.rb', line 32 def destroy_failed_object if load_object load_object.destroy if load_object.respond_to?('destroy') && !load_object.new_record? end end |
#errors ⇒ Object
28 29 30 |
# File 'lib/datashift/loaders/failure_data.rb', line 28 def errors end |