Module: Card::Set::All::Templating
- Extended by:
- Card::Set
- Defined in:
- platypus/tmp/set/gem-defaults/mod003-content/all/templating.rb
Overview
Set: All cards (Templating)
Constant Summary
Constants included from Helpers
Helpers::SET_PATTERN_TEST_REGEXP
Constants included from Event::Api
Class Method Summary collapse
Instance Method Summary collapse
-
#assigns_type? ⇒ Boolean
-
#is_structure? ⇒ Boolean
-
#is_template? ⇒ Boolean
-
#structure ⇒ Object
-
#structure_rule_card ⇒ Object
-
#template ⇒ Object
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
7 |
# File 'platypus/tmp/set/gem-defaults/mod003-content/all/templating.rb', line 7 def self.source_location; "/Users/ethan/dev/decko/gem/mod/content/set/all/templating.rb"; end |
Instance Method Details
#assigns_type? ⇒ Boolean
37 38 39 40 41 42 43 44 45 |
# File 'platypus/tmp/set/gem-defaults/mod003-content/all/templating.rb', line 37 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. pattern_code = Card.quick_fetch(name.trunk_name.tag_name)&.codename return unless pattern_code && (set_class = Set::Pattern.find pattern_code) set_class.assigns_type end |
#is_structure? ⇒ Boolean
17 18 19 20 21 |
# File 'platypus/tmp/set/gem-defaults/mod003-content/all/templating.rb', line 17 def is_structure? return @is_structure unless @is_structure.nil? @is_structure = name.right_name&.codename == :structure end |
#is_template? ⇒ Boolean
11 12 13 14 15 |
# File 'platypus/tmp/set/gem-defaults/mod003-content/all/templating.rb', line 11 def is_template? return @is_template unless @is_template.nil? @is_template = name.right_name&.codename&.in? %i[structure default] end |
#structure ⇒ Object
47 48 49 |
# File 'platypus/tmp/set/gem-defaults/mod003-content/all/templating.rb', line 47 def structure template&.is_structure? ? template : nil end |
#structure_rule_card ⇒ Object
51 52 53 54 55 |
# File 'platypus/tmp/set/gem-defaults/mod003-content/all/templating.rb', line 51 def structure_rule_card return unless (card = rule_card :structure, skip_modules: true) card.db_content&.strip == "_self" ? nil : card end |
#template ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'platypus/tmp/set/gem-defaults/mod003-content/all/templating.rb', line 23 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 |