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
- #date_view(date) ⇒ Object
- #link_view(opts = {}) ⇒ Object
- #name_variant(name) ⇒ Object
- #on_type_set ⇒ Object
- #safe_name ⇒ Object
- #show(view, args) ⇒ Object
- #specify_type_in_link!(opts) ⇒ Object
- #structure_card ⇒ Object
- #template_link_set_name ⇒ Object
- #valid_labeled_content ⇒ Object
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 |
#link_view(opts = {}) ⇒ Object
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_set ⇒ Object
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_name ⇒ Object
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() 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_card ⇒ Object
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 |
#template_link_set_name ⇒ Object
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_content ⇒ Object
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 |