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
34 35 36 37 38 39 40 41 42 |
# File 'platypus/tmp/set/gem-defaults/mod003-content/all/templating.rb', line 34 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
14 15 16 17 18 |
# File 'platypus/tmp/set/gem-defaults/mod003-content/all/templating.rb', line 14 def is_structure? return @is_structure unless @is_structure.nil? @is_structure = name.right_name&.codename == :structure end |
#is_template? ⇒ Boolean
8 9 10 11 12 |
# File 'platypus/tmp/set/gem-defaults/mod003-content/all/templating.rb', line 8 def is_template? return @is_template unless @is_template.nil? @is_template = name.right_name&.codename&.in? %i[structure default] end |
#structure ⇒ Object
44 45 46 |
# File 'platypus/tmp/set/gem-defaults/mod003-content/all/templating.rb', line 44 def structure template&.is_structure? ? template : nil end |
#structure_rule_card ⇒ Object
48 49 50 51 52 |
# File 'platypus/tmp/set/gem-defaults/mod003-content/all/templating.rb', line 48 def structure_rule_card return unless (card = rule_card :structure, skip_modules: true) card.db_content&.strip == "_self" ? nil : card end |
#template ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'platypus/tmp/set/gem-defaults/mod003-content/all/templating.rb', line 20 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 |