Module: Card::Set::All::Templating
- Extended by:
- Card::Set
- Defined in:
- tmpsets/set/mod002-core/all/templating.rb
Constant Summary
Constants included from Format
Constants included from Event::DelayedEvent
Event::DelayedEvent::DELAY_STAGES
Instance Method Summary collapse
- #assign_type_to?(structure) ⇒ Boolean
- #assigns_type? ⇒ Boolean
- #is_structure? ⇒ Boolean
-
#is_template? ⇒ Boolean
~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/core/set/all/templating.rb ~~.
- #new_card_template ⇒ Object
- #structure ⇒ Object
- #structure_rule_card ⇒ Object
- #template ⇒ Object
- #virtual? ⇒ Boolean
Methods included from I18nScope
Methods included from Loader
#clean_empty_module_from_hash, #clean_empty_modules, #extended, #process_base_modules, #register_set
Methods included from Helpers
#abstract_set?, #all_set?, #num_set_parts, #shortname
Methods included from Card::Set::AdvancedApi
#attachment, #ensure_set, #stage_method
Methods included from Format
#all_set_format_mod!, #define_on_format, #format, #register_set_format, #view
Methods included from Inheritance
#include_set, #include_set_formats
Methods included from Basket
#abstract_basket, #add_to_basket, #basket
Methods included from Trait
#card_accessor, #card_reader, #card_writer
Methods included from Event
Instance Method Details
#assign_type_to?(structure) ⇒ Boolean
42 43 44 45 |
# File 'tmpsets/set/mod002-core/all/templating.rb', line 42 def assign_type_to? structure return if type_id == structure.type_id structure.assigns_type? end |
#assigns_type? ⇒ Boolean
47 48 49 50 51 52 53 54 55 56 |
# File 'tmpsets/set/mod002-core/all/templating.rb', line 47 def assigns_type? # needed because not all *structure templates govern the type of set members # for example, X+*type+*structure governs all cards of type X, # but the content rule does not (in fact cannot) have the type X. return unless (set_pattern = Card.fetch cardname.trunk_name.tag_name, skip_modules: true) return unless (pattern_code = set_pattern.codename) return unless (set_class = Set::Pattern.find pattern_code) set_class.assigns_type end |
#is_structure? ⇒ Boolean
9 10 11 |
# File 'tmpsets/set/mod002-core/all/templating.rb', line 9 def is_structure? cardname.trait_name? :structure end |
#is_template? ⇒ Boolean
~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/core/set/all/templating.rb ~~
5 6 7 |
# File 'tmpsets/set/mod002-core/all/templating.rb', line 5 def is_template? cardname.trait_name? :structure, :default end |
#new_card_template ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'tmpsets/set/mod002-core/all/templating.rb', line 27 def new_card_template default = rule_card :default, skip_modules: true dup_card = dup dup_card.type_id = default ? default.type_id : Card.default_type_id if (structure = dup_card.structure_rule_card) @virtual = true if junction? self.type_id = structure.type_id if assign_type_to?(structure) structure else default end end |
#structure ⇒ Object
58 59 60 61 |
# File 'tmpsets/set/mod002-core/all/templating.rb', line 58 def structure return unless template && template.is_structure? template end |
#structure_rule_card ⇒ Object
71 72 73 74 |
# File 'tmpsets/set/mod002-core/all/templating.rb', line 71 def structure_rule_card card = rule_card :structure, skip_modules: true card && card.db_content.strip == "_self" ? nil : card end |
#template ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'tmpsets/set/mod002-core/all/templating.rb', line 13 def template # currently applicable templating card. # note that a *default template is never returned for an existing card. @template ||= begin @virtual = false if new_card? new_card_template else structure_rule_card end end end |
#virtual? ⇒ Boolean
63 64 65 66 67 68 69 |
# File 'tmpsets/set/mod002-core/all/templating.rb', line 63 def virtual? return false unless new_card? if @virtual.nil? cardname.simple? ? (@virtual = false) : template end @virtual end |