Module: Card::Set::All::Base::Format

Extended by:
Card::Set::AbstractFormat
Defined in:
tmpsets/set/mod006-basic_formats/all/base.rb

Instance Method Summary collapse

Instance Method Details

#date_view(date) ⇒ Object



67
68
69
70
71
72
73
# File 'tmpsets/set/mod006-basic_formats/all/base.rb', line 67

def date_view date
  if voo.variant
    date.strftime voo.variant
  else
    time_ago_in_words date
  end
end


45
46
47
48
49
# File 'tmpsets/set/mod006-basic_formats/all/base.rb', line 45

def link_view opts={}
  opts[:known] = card.known?
  specify_type_in_link! opts
  link_to_card card.name, _render_title, opts
end

#name_variant(name) ⇒ Object



24
25
26
# File 'tmpsets/set/mod006-basic_formats/all/base.rb', line 24

def name_variant name
  voo.variant ? name.to_name.vary(voo.variant) : name
end

#on_type_setObject



172
173
174
175
176
177
178
179
180
# File 'tmpsets/set/mod006-basic_formats/all/base.rb', line 172

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

#safe_nameObject



20
21
22
# File 'tmpsets/set/mod006-basic_formats/all/base.rb', line 20

def safe_name
  card&.name
end

#show(view, args) ⇒ Object



9
10
11
12
# File 'tmpsets/set/mod006-basic_formats/all/base.rb', line 9

def show view, args
  view ||= :core
  render! view, args.merge(main_nest_options)
end

#specify_type_in_link!(opts) ⇒ Object



51
52
53
54
# File 'tmpsets/set/mod006-basic_formats/all/base.rb', line 51

def specify_type_in_link! opts
  return if opts[:known] || !voo.type
  opts[:path] = { card: { type: voo.type } }
end

#structure_cardObject



81
82
83
84
# File 'tmpsets/set/mod006-basic_formats/all/base.rb', line 81

def structure_card
  return nil if voo.structure == true
  voo.structure ? Card[voo.structure] : card
end


161
162
163
164
165
166
167
168
169
170
# File 'tmpsets/set/mod006-basic_formats/all/base.rb', line 161

def template_link_set_name
  name = voo.nest_name.to_name
  if name.absolute?
    name.trait_name :self
  elsif (type = on_type_set)
    [type, name].to_name.trait_name :type_plus_right
  else
    name.stripped.gsub(/^\+/, "").to_name.trait_name :right
  end
end

#valid_labeled_contentObject



108
109
110
111
112
113
114
# File 'tmpsets/set/mod006-basic_formats/all/base.rb', line 108

def valid_labeled_content
  if card.known?
    yield
  else
    createable { missing_link(fa_icon("plus-square")) }
  end
end