Class: NcsNavigator::Warehouse::TransformStatus
- Inherits:
-
Object
- Object
- NcsNavigator::Warehouse::TransformStatus
- Includes:
- DataMapper::Resource
- Defined in:
- lib/ncs_navigator/warehouse/transform_status.rb
Overview
Tracks and stores the progress of a particular transform.
Class Method Summary collapse
-
.memory_only(name, attrs = {}) ⇒ Object
DataMapper 1.2 attempts to query for associations, even if the record has never been saved.
Instance Method Summary collapse
Class Method Details
.memory_only(name, attrs = {}) ⇒ Object
DataMapper 1.2 attempts to query for associations, even if the record has never been saved. This fails if the database connection is not set up (as in most of this library's tests). This method creates a new instance which works around this problem, at the cost of the instances not being accurately persistable.
18 19 20 21 22 23 24 |
# File 'lib/ncs_navigator/warehouse/transform_status.rb', line 18 def self.memory_only(name, attrs={}) TransformStatus.new(attrs.merge(:name => name)).tap do |s| def s.transform_errors @transform_errors ||= [] end end end |
Instance Method Details
#add_error(message) ⇒ Object
38 39 40 |
# File 'lib/ncs_navigator/warehouse/transform_status.rb', line 38 def add_error() self.transform_errors << TransformError.new(:message => ) end |
#unsuccessful_record(record, message, error_attributes = {}) ⇒ Object
42 43 44 45 46 47 48 49 |
# File 'lib/ncs_navigator/warehouse/transform_status.rb', line 42 def unsuccessful_record(record, , error_attributes={}) self.transform_errors << TransformError.new({ :model_class => record.class, :record_id => (record.key.first if record && record.key), :message => }.merge(error_attributes)) end |