Module: Card::Set::All::ReferenceEvents
- Extended by:
- Card::Set
- Defined in:
- platypus/tmp/set/gem-card/mod001-core/all/reference_events.rb
Overview
when content changes, update references to other cards
Constant Summary
Constants included from Helpers
Helpers::SET_PATTERN_TEST_REGEXP
Constants included from Event::Api
Class Method Summary collapse
Instance Method Summary collapse
-
#event: clear_references ⇒ Object
clean up reference table when card is deleted.
-
#event: refresh_references_in ⇒ Object
when name changes, update references to card.
-
#event: refresh_references_out ⇒ Object
-
#event: update_referer_content ⇒ Object
on rename, update names in cards that refer to self by name (as directed).
-
#event: update_referer_references_out ⇒ Object
on rename, when NOT updating referer content, update references to ensure that partial references are correctly tracked eg.
Methods included from Card::Set
Methods included from I18nScope
Methods included from Registrar
#extended, #finalize_load, #process_base_modules, #register_set
Methods included from Helpers
#format_module, #format_modules, #method_missing, #modules, #pattern_code, #respond_to_missing?, #set_name_parts, #shortname, #underscored_name
Methods included from Card::Set::AdvancedApi
#assign_type, #attachment, #define_set_from_error, #ensure_set, #setting_opts, #stage_method
Methods included from Format
#before, #format, layout_method_name, #view, view_method_name, view_setting_method_name, wrapper_method_name
Methods included from Inheritance
#include_set, #include_set_formats
Methods included from Trait
#card_accessor, #card_reader, #card_writer, #require_field
Methods included from Event::Api
Class Method Details
.source_location ⇒ Object
8 |
# File 'platypus/tmp/set/gem-card/mod001-core/all/reference_events.rb', line 8 def self.source_location; "/Users/ethan/dev/decko/gem/card/mod/core/set/all/reference_events.rb"; end |
Instance Method Details
#event: clear_references ⇒ Object
clean up reference table when card is deleted
35 36 37 38 |
# File 'platypus/tmp/set/gem-card/mod001-core/all/reference_events.rb', line 35 event :clear_references, :finalize, on: :delete do delete_references_out Reference.unmap_referees id end |
#event: refresh_references_in ⇒ Object
when name changes, update references to card
29 30 31 32 |
# File 'platypus/tmp/set/gem-card/mod001-core/all/reference_events.rb', line 29 event :refresh_references_in, :finalize, changed: :name, on: :save do Reference.unmap_referees id if action == :update && skip_update_referers? Reference.map_referees key, id end |
#event: refresh_references_out ⇒ Object
9 10 11 |
# File 'platypus/tmp/set/gem-card/mod001-core/all/reference_events.rb', line 9 event :refresh_references_out, :finalize, on: :save, changed: :content do update_references_out end |
#event: update_referer_content ⇒ Object
on rename, update names in cards that refer to self by name (as directed)
14 15 16 17 |
# File 'platypus/tmp/set/gem-card/mod001-core/all/reference_events.rb', line 14 event :update_referer_content, :finalize, on: :update, changed: :name, skip: :allowed do referers.each { |r| r.replace_references name_before_act, name } each_descendant { |d| d.rename_as_descendant !skip_update_referers? } end |
#event: update_referer_references_out ⇒ Object
on rename, when NOT updating referer content, update references to ensure that partial references are correctly tracked eg. A links to X+Y. if X+Y is renamed and we’re not updating the link in A, then we need to be sure that A has a partial reference
23 24 25 26 |
# File 'platypus/tmp/set/gem-card/mod001-core/all/reference_events.rb', line 23 event :update_referer_references_out, :finalize, changed: :name, on: :update, when: :skip_update_referers? do referers.map(&:update_references_out) end |