Module: Card::Set::All::Item
- Extended by:
- Card::Set
- Defined in:
- platypus/tmp/set/gem-defaults/mod002-collection/all/item.rb
Overview
ITEM LISTS
Defined Under Namespace
Modules: Format, HtmlFormat
Constant Summary
Constants included from Helpers
Helpers::SET_PATTERN_TEST_REGEXP
Constants included from Event::Api
Class Method Summary collapse
Instance Method Summary collapse
-
#first_card(args = {}) ⇒ Card
-
#first_code(args = {}) ⇒ Symbol
-
#first_id(args = {}) ⇒ Integer
-
#first_name(args = {}) ⇒ Card::Name
-
#include_item?(item) ⇒ Boolean
-
#item_cards(args = {}) ⇒ Array
List of cards.
-
#item_count(args = {}) ⇒ Object
MISC.
-
#item_ids(args = {}) ⇒ Array
List of integers (card ids of items).
-
#item_keys(args = {}) ⇒ Array
Of String objects.
-
#item_names(args = {}) ⇒ Array
List of Card::Name objects.
-
#item_strings(args = {}) ⇒ Array
Of String objects.
-
#item_type_card ⇒ Object
-
#item_type_id ⇒ Object
typically override EITHER #item_type_id OR #item_type_name.
-
#item_type_name ⇒ Object
-
#item_value(item_name) ⇒ Object
for override, eg by json.
Methods included from Card::Set
Methods included from I18nScope
Methods included from Registrar
#extended, #finalize_load, #process_base_modules, #register_set
Methods included from Helpers
#format_module, #format_modules, #method_missing, #modules, #pattern_code, #respond_to_missing?, #set_name_parts, #shortname, #underscored_name
Methods included from Card::Set::AdvancedApi
#assign_type, #attachment, #define_set_from_error, #ensure_set, #setting_opts, #stage_method
Methods included from Format
#before, #format, layout_method_name, #view, view_method_name, view_setting_method_name, wrapper_method_name
Methods included from Inheritance
#include_set, #include_set_formats
Methods included from Trait
#card_accessor, #card_reader, #card_writer, #require_field
Methods included from Event::Api
Class Method Details
.source_location ⇒ Object
9 |
# File 'platypus/tmp/set/gem-defaults/mod002-collection/all/item.rb', line 9 def self.source_location; "/Users/ethan/dev/decko/gem/mod/collection/set/all/item.rb"; end |
Instance Method Details
#first_card(args = {}) ⇒ Card
68 69 70 71 72 |
# File 'platypus/tmp/set/gem-defaults/mod002-collection/all/item.rb', line 68 def first_card args={} return unless (name = first_name) fetch_item_card name, args end |
#first_code(args = {}) ⇒ Symbol
76 77 78 |
# File 'platypus/tmp/set/gem-defaults/mod002-collection/all/item.rb', line 76 def first_code args={} first_card(args)&.codename end |
#first_id(args = {}) ⇒ Integer
82 83 84 |
# File 'platypus/tmp/set/gem-defaults/mod002-collection/all/item.rb', line 82 def first_id args={} first_name(args)&.card_id end |
#first_name(args = {}) ⇒ Card::Name
62 63 64 |
# File 'platypus/tmp/set/gem-defaults/mod002-collection/all/item.rb', line 62 def first_name args={} item_names(args).first end |
#include_item?(item) ⇒ Boolean
107 108 109 |
# File 'platypus/tmp/set/gem-defaults/mod002-collection/all/item.rb', line 107 def include_item? item item_names.include? Card::Name[item] end |
#item_cards(args = {}) ⇒ Array
Returns list of cards.
31 32 33 |
# File 'platypus/tmp/set/gem-defaults/mod002-collection/all/item.rb', line 31 def item_cards args={} standard_item_cards args end |
#item_count(args = {}) ⇒ Object
MISC
103 104 105 |
# File 'platypus/tmp/set/gem-defaults/mod002-collection/all/item.rb', line 103 def item_count args={} item_names(args).size end |
#item_ids(args = {}) ⇒ Array
Returns list of integers (card ids of items).
37 38 39 |
# File 'platypus/tmp/set/gem-defaults/mod002-collection/all/item.rb', line 37 def item_ids args={} item_names(args).map(&:card_id).compact end |
#item_keys(args = {}) ⇒ Array
Returns of String objects.
43 44 45 46 47 |
# File 'platypus/tmp/set/gem-defaults/mod002-collection/all/item.rb', line 43 def item_keys args={} item_names(args).map do |item| item.to_name.key end end |
#item_names(args = {}) ⇒ Array
Returns list of Card::Name objects.
22 23 24 25 26 27 |
# File 'platypus/tmp/set/gem-defaults/mod002-collection/all/item.rb', line 22 def item_names args={} context = args[:context] item_strings(args).map do |item| clean_item_name item, context end.compact end |
#item_strings(args = {}) ⇒ Array
Returns of String objects.
51 52 53 54 55 56 |
# File 'platypus/tmp/set/gem-defaults/mod002-collection/all/item.rb', line 51 def item_strings args={} items = raw_item_strings(args[:content] || content) return items unless args.present? filtered_items items, limit: args[:limit], offset: args[:offset] end |
#item_type_card ⇒ Object
97 98 99 |
# File 'platypus/tmp/set/gem-defaults/mod002-collection/all/item.rb', line 97 def item_type_card item_type_id&.card end |
#item_type_id ⇒ Object
typically override EITHER #item_type_id OR #item_type_name
89 90 91 |
# File 'platypus/tmp/set/gem-defaults/mod002-collection/all/item.rb', line 89 def item_type_id @item_type_id ||= no_item_type_recursion { item_type_name&.card_id } end |
#item_type_name ⇒ Object
93 94 95 |
# File 'platypus/tmp/set/gem-defaults/mod002-collection/all/item.rb', line 93 def item_type_name @item_type_name ||= no_item_type_recursion { item_type_id&.cardname } end |
#item_value(item_name) ⇒ Object
for override, eg by json
112 113 114 |
# File 'platypus/tmp/set/gem-defaults/mod002-collection/all/item.rb', line 112 def item_value item_name item_name end |