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
70 71 72 73 74 |
# File 'platypus/tmp/set/gem-defaults/mod002-collection/all/item.rb', line 70 def first_card args={} return unless (name = first_name) fetch_item_card name, args end |
#first_code(args = {}) ⇒ Symbol
78 79 80 |
# File 'platypus/tmp/set/gem-defaults/mod002-collection/all/item.rb', line 78 def first_code args={} first_card(args)&.codename end |
#first_id(args = {}) ⇒ Integer
84 85 86 |
# File 'platypus/tmp/set/gem-defaults/mod002-collection/all/item.rb', line 84 def first_id args={} first_name(args)&.card_id end |
#first_name(args = {}) ⇒ Card::Name
64 65 66 |
# File 'platypus/tmp/set/gem-defaults/mod002-collection/all/item.rb', line 64 def first_name args={} item_names(args).first end |
#include_item?(item) ⇒ Boolean
109 110 111 |
# File 'platypus/tmp/set/gem-defaults/mod002-collection/all/item.rb', line 109 def include_item? item item_names.include? Card::Name[item] end |
#item_cards(args = {}) ⇒ Array
Returns list of cards.
33 34 35 |
# File 'platypus/tmp/set/gem-defaults/mod002-collection/all/item.rb', line 33 def item_cards args={} standard_item_cards args end |
#item_count(args = {}) ⇒ Object
MISC
105 106 107 |
# File 'platypus/tmp/set/gem-defaults/mod002-collection/all/item.rb', line 105 def item_count args={} item_names(args).size end |
#item_ids(args = {}) ⇒ Array
Returns list of integers (card ids of items).
39 40 41 |
# File 'platypus/tmp/set/gem-defaults/mod002-collection/all/item.rb', line 39 def item_ids args={} item_names(args).map(&:card_id).compact end |
#item_keys(args = {}) ⇒ Array
Returns of String objects.
45 46 47 48 49 |
# File 'platypus/tmp/set/gem-defaults/mod002-collection/all/item.rb', line 45 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 28 29 |
# File 'platypus/tmp/set/gem-defaults/mod002-collection/all/item.rb', line 22 def item_names args={} seeding_names do context = args[:context] item_strings(args).map do |item| clean_item_name item, context end.compact end end |
#item_strings(args = {}) ⇒ Array
Returns of String objects.
53 54 55 56 57 58 |
# File 'platypus/tmp/set/gem-defaults/mod002-collection/all/item.rb', line 53 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
99 100 101 |
# File 'platypus/tmp/set/gem-defaults/mod002-collection/all/item.rb', line 99 def item_type_card item_type_id&.card end |
#item_type_id ⇒ Object
typically override EITHER #item_type_id OR #item_type_name
91 92 93 |
# File 'platypus/tmp/set/gem-defaults/mod002-collection/all/item.rb', line 91 def item_type_id @item_type_id ||= no_item_type_recursion { item_type_name&.card_id } end |
#item_type_name ⇒ Object
95 96 97 |
# File 'platypus/tmp/set/gem-defaults/mod002-collection/all/item.rb', line 95 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
114 115 116 |
# File 'platypus/tmp/set/gem-defaults/mod002-collection/all/item.rb', line 114 def item_value item_name item_name end |