Module: Card::Set::All::TemplateNest::Format

Extended by:
Card::Set::AbstractFormat
Defined in:
card/tmpsets/set/mod012-card-mod-edit/all/template_nest.rb,
card/tmpsets/set/mod011-card-mod-edit/all/template_nest.rb

Instance Method Summary collapse

Instance Method Details

#on_type_setObject



40
41
42
43
44
45
46
47
48
# File 'card/tmpsets/set/mod012-card-mod-edit/all/template_nest.rb', line 40

def on_type_set
  return unless
    (tmpl_set_name = parent.card.name.trunk_name) &&
    (tmpl_set_class_name = tmpl_set_name.tag_name) &&
    (tmpl_set_class_card = Card[tmpl_set_class_name]) &&
    (tmpl_set_class_card.codename == :type)

  tmpl_set_name.left_name
end


21
22
23
24
25
26
27
28
# File 'card/tmpsets/set/mod012-card-mod-edit/all/template_nest.rb', line 21

def template_link_set_name
  name = voo.nest_name.to_name
  if name.absolute?
    name.trait_name :self
  else
    template_link_set_name_for_relative_name name
  end
end


30
31
32
33
34
35
36
37
38
# File 'card/tmpsets/set/mod012-card-mod-edit/all/template_nest.rb', line 30

def template_link_set_name_for_relative_name name
  name = name.stripped.gsub(/^\+/, "")

  if (type = on_type_set)
    [type, name].to_name.trait_name :type_plus_right
  else
    name.to_name.trait_name :right
  end
end

#view: template_nestObject



9
10
11
12
13
14
15
16
17
18
19
# File 'card/tmpsets/set/mod012-card-mod-edit/all/template_nest.rb', line 9

view :template_nest, cache: :never, unknown: true do
  return "" unless voo.nest_name

  if voo.nest_name.to_name.field_only?
    with_nest_mode :normal do
      nest template_link_set_name, view: :template_link
    end
  else
    "{{#{voo.nest_syntax}}}"
  end
end