Module: FlatMap::BaseMapper::Skipping
- Included in:
- FlatMap::BaseMapper
- Defined in:
- lib/flat_map/base_mapper/skipping.rb
Overview
This helper module provides helper functionality that allow to exclude specific mapper from a processing chain.
Instance Method Summary collapse
-
#save ⇒ Boolean
Override Persistence#save method to force it to return
trueifselfis marked for skipping. -
#shallow_save ⇒ Boolean
Override Persistence#shallow_save method to make it possible to skip traits.
-
#skip! ⇒ Object
Mark self as skipped, i.e.
-
#skipped? ⇒ Boolean
Return
trueifselfwas marked for skipping. -
#use! ⇒ Object
Remove “skip” mark from
selfand “destroyed” flag from the target. -
#valid?(context = nil) ⇒ Boolean
Override Persistence#valid? to force it to return
trueifselfis marked for skipping. -
#write ⇒ Object
Mark self as used and then delegated to original Persistence#write.
Instance Method Details
#save ⇒ Boolean
Override Persistence#save method to force it to return true if self is marked for skipping.
43 44 45 |
# File 'lib/flat_map/base_mapper/skipping.rb', line 43 def save skipped? || super end |
#shallow_save ⇒ Boolean
Override Persistence#shallow_save method to make it possible to skip traits.
51 52 53 |
# File 'lib/flat_map/base_mapper/skipping.rb', line 51 def shallow_save skipped? || super end |
#skip! ⇒ Object
Mark self as skipped, i.e. it will not be subject of validation and saving chain.
9 10 11 |
# File 'lib/flat_map/base_mapper/skipping.rb', line 9 def skip! @_skip_processing = true end |
#skipped? ⇒ Boolean
Return true if self was marked for skipping.
24 25 26 |
# File 'lib/flat_map/base_mapper/skipping.rb', line 24 def skipped? !!@_skip_processing end |
#use! ⇒ Object
Remove “skip” mark from self and “destroyed” flag from the target.
17 18 19 |
# File 'lib/flat_map/base_mapper/skipping.rb', line 17 def use! @_skip_processing = nil end |
#valid?(context = nil) ⇒ Boolean
Override Persistence#valid? to force it to return true if self is marked for skipping.
35 36 37 |
# File 'lib/flat_map/base_mapper/skipping.rb', line 35 def valid?(context = nil) skipped? || super end |
#write ⇒ Object
Mark self as used and then delegated to original Persistence#write.
57 58 59 60 |
# File 'lib/flat_map/base_mapper/skipping.rb', line 57 def write(*) use! super end |