Module: Card::Set::All::Item::Format

Extended by:
Card::Set::AbstractFormat
Defined in:
card/tmpsets/set/mod006-card-mod-collection/all/item.rb,
card/tmpsets/set/mod005-card-mod-collection/all/item.rb

Instance Method Summary collapse

Instance Method Details

#default_item_viewObject



102
103
104
# File 'card/tmpsets/set/mod006-card-mod-collection/all/item.rb', line 102

def default_item_view
  :name
end

#determine_item_view_options_type(options) ⇒ Object



114
115
116
117
118
# File 'card/tmpsets/set/mod006-card-mod-collection/all/item.rb', line 114

def determine_item_view_options_type options
  return if options[:type]
  type_from_rule = card.item_type
  options[:type] = type_from_rule if type_from_rule
end

#implicit_item_viewObject



92
93
94
95
# File 'card/tmpsets/set/mod006-card-mod-collection/all/item.rb', line 92

def implicit_item_view
  view = voo_items_view || default_item_view
  Card::View.normalize view
end


82
83
84
# File 'card/tmpsets/set/mod006-card-mod-collection/all/item.rb', line 82

def item_links _args={}
  raw(render_core).split(/[,\n]/)
end

#item_view_options(new_options = {}) ⇒ Object



106
107
108
109
110
111
112
# File 'card/tmpsets/set/mod006-card-mod-collection/all/item.rb', line 106

def item_view_options new_options={}
  options = (voo.items || {}).clone
  options = options.merge new_options
  options[:view] ||= implicit_item_view
  determine_item_view_options_type options
  options
end

#listing(listing_cards, item_args = {}) ⇒ Object



120
121
122
123
124
125
126
# File 'card/tmpsets/set/mod006-card-mod-collection/all/item.rb', line 120

def listing listing_cards, item_args={}
  listing_cards.map do |item_card|
    nest_item item_card, item_args do |rendered, item_view|
      wrap_item rendered, item_view
    end
  end
end

#nest_item(cardish, options = {}, &block) ⇒ Object



86
87
88
89
90
# File 'card/tmpsets/set/mod006-card-mod-collection/all/item.rb', line 86

def nest_item cardish, options={}, &block
  options = item_view_options options
  options[:nest_name] = Card::Name[cardish].s
  nest cardish, options, &block
end

#voo_items_viewObject



97
98
99
100
# File 'card/tmpsets/set/mod006-card-mod-collection/all/item.rb', line 97

def voo_items_view
  return unless voo && (items = voo.items)
  items[:view]
end

#wrap_item(item, _args = {}) ⇒ Object



128
129
130
# File 'card/tmpsets/set/mod006-card-mod-collection/all/item.rb', line 128

def wrap_item item, _args={}
  item # no wrap in base
end