Module: FlatMap::OpenMapper::Skipping
- Extended by:
- ActiveSupport::Autoload
- Included in:
- FlatMap::OpenMapper
- Defined in:
- lib/flat_map/open_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
true
ifself
is 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
true
ifself
was marked for skipping. -
#use! ⇒ Object
Remove “skip” mark from
self
and “destroyed” flag from the target. -
#valid?(context = nil) ⇒ Boolean
Override Persistence#valid? to force it to return
true
ifself
is 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.
47 48 49 |
# File 'lib/flat_map/open_mapper/skipping.rb', line 47 def save skipped? || super end |
#shallow_save ⇒ Boolean
Override Persistence#shallow_save method to make it possible to skip traits.
55 56 57 |
# File 'lib/flat_map/open_mapper/skipping.rb', line 55 def shallow_save skipped? || super end |
#skip! ⇒ Object
Mark self as skipped, i.e. it will not be subject of validation and saving chain.
13 14 15 |
# File 'lib/flat_map/open_mapper/skipping.rb', line 13 def skip! @_skip_processing = true end |
#skipped? ⇒ Boolean
Return true
if self
was marked for skipping.
28 29 30 |
# File 'lib/flat_map/open_mapper/skipping.rb', line 28 def skipped? !!@_skip_processing end |
#use! ⇒ Object
Remove “skip” mark from self
and “destroyed” flag from the target.
21 22 23 |
# File 'lib/flat_map/open_mapper/skipping.rb', line 21 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.
39 40 41 |
# File 'lib/flat_map/open_mapper/skipping.rb', line 39 def valid?(context = nil) skipped? || super end |
#write ⇒ Object
Mark self as used and then delegated to original Persistence#write.
61 62 63 64 |
# File 'lib/flat_map/open_mapper/skipping.rb', line 61 def write(*) use! super end |