Module: Card::Set::Type::List

Extended by:
Card::Set
Defined in:
tmpsets/set/mod016-standard/type/list.rb

Constant Summary

Constants included from Format

Format::TEMPLATE_DIR

Instance Method Summary collapse

Methods included from I18nScope

#mod_name, #scope

Methods included from Loader

#clean_empty_module_from_hash, #clean_empty_modules, #extended, #process_base_modules, #register_set

Methods included from Helpers

#abstract_set?, #all_set?, #num_set_parts, #shortname

Methods included from AdvancedApi

#attachment, #ensure_set, #stage_method

Methods included from Format

#all_set_format_mod!, #before, #define_on_format, #format, #register_set_format, #view, #view_for_override

Methods included from Inheritance

#include_set, #include_set_formats

Methods included from Basket

#abstract_basket, #add_to_basket, #basket

Methods included from Card::Set::Trait

#card_accessor, #card_reader, #card_writer

Methods included from Event::Api

#event

Instance Method Details

#item_typeObject



102
103
104
# File 'tmpsets/set/mod016-standard/type/list.rb', line 102

def item_type
  cardname.right
end

#item_type_cardObject



110
111
112
# File 'tmpsets/set/mod016-standard/type/list.rb', line 110

def item_type_card
  cardname.right
end

#item_type_idObject



114
115
116
# File 'tmpsets/set/mod016-standard/type/list.rb', line 114

def item_type_id
  right.id
end

#item_type_nameObject



106
107
108
# File 'tmpsets/set/mod016-standard/type/list.rb', line 106

def item_type_name
  cardname.right_name
end

#update_all_itemsObject



78
79
80
81
82
83
84
85
# File 'tmpsets/set/mod016-standard/type/list.rb', line 78

def update_all_items
  current_items = item_keys
  if db_content_was
    old_items = item_keys(content: db_content_was)
    update_listed_by_cache_for old_items
  end
  update_listed_by_cache_for current_items
end

#update_listed_by_cache_for(item_keys, args = {}) ⇒ Object



87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'tmpsets/set/mod016-standard/type/list.rb', line 87

def update_listed_by_cache_for item_keys, args={}
  type_key = args[:type_key] || left.type_card.key

  item_keys.each do |item_key|
    key = "#{item_key}+#{type_key}"
    next unless Card::Cache[Card::Set::Type::ListedBy].exist? key
    if (card = Card.fetch(key))
      card.update_cached_list
      card.update_references_out
    else
      Card::Cache[Card::Set::Type::ListedBy].delete key
    end
  end
end