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

Extended by:
Card::Set::AbstractFormat
Defined in:
tmpsets/set/mod003-core/all/item.rb

Instance Method Summary collapse

Instance Method Details

#default_item_viewObject



86
87
88
# File 'tmpsets/set/mod003-core/all/item.rb', line 86

def default_item_view
  :name
end

#determine_item_view_options_type(options) ⇒ Object



98
99
100
101
102
# File 'tmpsets/set/mod003-core/all/item.rb', line 98

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



76
77
78
79
# File 'tmpsets/set/mod003-core/all/item.rb', line 76

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


66
67
68
# File 'tmpsets/set/mod003-core/all/item.rb', line 66

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

#item_view_options(new_options = {}) ⇒ Object



90
91
92
93
94
95
96
# File 'tmpsets/set/mod003-core/all/item.rb', line 90

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



104
105
106
107
108
109
110
# File 'tmpsets/set/mod003-core/all/item.rb', line 104

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



70
71
72
73
74
# File 'tmpsets/set/mod003-core/all/item.rb', line 70

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



81
82
83
84
# File 'tmpsets/set/mod003-core/all/item.rb', line 81

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

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



112
113
114
# File 'tmpsets/set/mod003-core/all/item.rb', line 112

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