Class: NcsNavigator::Warehouse::Filters::AddIdPrefixFilter
- Inherits:
-
Object
- Object
- NcsNavigator::Warehouse::Filters::AddIdPrefixFilter
- Includes:
- RecordIdChangingFilterSupport
- Defined in:
- lib/ncs_navigator/warehouse/filters/add_id_prefix_filter.rb
Overview
A filter which adds a prefix to the ID for every record of a given type. This filter is stateful and so must be instantiated.
Instance Attribute Summary
Attributes included from RecordIdChangingFilterSupport
Instance Method Summary collapse
-
#changed_id(original_id) ⇒ String
The ID with the prefix applied.
-
#initialize(configuration, options = {}) ⇒ AddIdPrefixFilter
constructor
Creates the filter.
Methods included from RecordIdChangingFilterSupport
Constructor Details
#initialize(configuration, options = {}) ⇒ AddIdPrefixFilter
Creates the filter.
In addition to the options specified here, this constructor accepts the options defined on RecordIdChangingFilterSupport#initialize.
20 21 22 23 |
# File 'lib/ncs_navigator/warehouse/filters/add_id_prefix_filter.rb', line 20 def initialize(configuration, ={}) super @prefix = [:prefix] or fail 'Please specify a :prefix.' end |
Instance Method Details
#changed_id(original_id) ⇒ String
Returns the ID with the prefix applied.
28 29 30 |
# File 'lib/ncs_navigator/warehouse/filters/add_id_prefix_filter.rb', line 28 def changed_id(original_id) "#{@prefix}#{original_id}" if original_id end |