Module: Card::Set::All::Templating
- Extended by:
- Card::Set
- Defined in:
- tmpsets/set/mod001-01_core/all/templating.rb
Instance Method Summary
collapse
Methods included from Card::Set
abstract_set?, all_set?, card_accessor, card_reader, card_writer, clean_empty_module_from_hash, clean_empty_modules, define_on_format, ensure_set, extended, format, process_base_module_list, process_base_modules, register_set, register_set_format, shortname, stage_method, view, write_tmp_file
Methods included from Event
#define_event, #event
Instance Method Details
#assign_type_to?(structure) ⇒ Boolean
42
43
44
45
|
# File 'tmpsets/set/mod001-01_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/mod001-01_core/all/templating.rb', line 47
def assigns_type?
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 = Card::SetPattern.find pattern_code)
set_class.assigns_type
end
|
#is_structure? ⇒ Boolean
9
10
11
|
# File 'tmpsets/set/mod001-01_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/01_core/set/all/templating.rb ~~~~~~~~~~~
5
6
7
|
# File 'tmpsets/set/mod001-01_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/mod001-01_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/mod001-01_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/mod001-01_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
|
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'tmpsets/set/mod001-01_core/all/templating.rb', line 13
def template
@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/mod001-01_core/all/templating.rb', line 63
def virtual?
return false unless new_card?
if @virtual.nil?
cardname.simple? ? (@virtual = false) : template
end
@virtual
end
|