Module: Card::Set::All::Pattern
- Extended by:
- Card::Set
- Defined in:
- tmpsets/set/mod002-core/all/pattern.rb
Constant Summary
Constants included from Format
Constants included from Event::DelayedEvent
Event::DelayedEvent::DELAY_STAGES
Instance Method Summary collapse
- #in_set?(set_module) ⇒ Boolean
-
#patterns ⇒ Object
~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/core/set/all/pattern.rb ~~.
- #patterns_with_new ⇒ Object
- #reset_patterns ⇒ Object
- #reset_patterns_if_rule(saving = false) ⇒ Object
- #rule_set_keys ⇒ Object
- #safe_set_keys ⇒ Object
- #set_format_modules(klass) ⇒ Object
- #set_modules ⇒ Object
- #set_names ⇒ Object
Methods included from I18nScope
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 Card::Set::AdvancedApi
#attachment, #ensure_set, #stage_method
Methods included from Format
#all_set_format_mod!, #define_on_format, #format, #register_set_format, #view
Methods included from Inheritance
#include_set, #include_set_formats
Methods included from Basket
#abstract_basket, #add_to_basket, #basket
Methods included from Trait
#card_accessor, #card_reader, #card_writer
Methods included from Event
Instance Method Details
#in_set?(set_module) ⇒ Boolean
57 58 59 |
# File 'tmpsets/set/mod002-core/all/pattern.rb', line 57 def in_set? set_module patterns.map(&:module_key).include? set_module.shortname end |
#patterns ⇒ Object
~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/core/set/all/pattern.rb ~~
5 6 7 |
# File 'tmpsets/set/mod002-core/all/pattern.rb', line 5 def patterns @patterns ||= set_patterns.map { |sub| sub.new self }.compact end |
#patterns_with_new ⇒ Object
9 10 11 |
# File 'tmpsets/set/mod002-core/all/pattern.rb', line 9 def patterns_with_new new_card? ? patterns_without_new[1..-1] : patterns_without_new end |
#reset_patterns ⇒ Object
14 15 16 17 18 19 20 |
# File 'tmpsets/set/mod002-core/all/pattern.rb', line 14 def reset_patterns @patterns = nil @template = @virtual = nil @set_mods_loaded = @set_modules = @set_names = @rule_set_keys = nil @junction_only = nil # only applies to set cards true end |
#reset_patterns_if_rule(saving = false) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'tmpsets/set/mod002-core/all/pattern.rb', line 22 def reset_patterns_if_rule saving=false if !new_card? && is_rule? set = left set.reset_patterns set.include_set_modules # FIXME: should be in right/read.rb if saving && right.id == Card::ReadID add_to_read_rule_update_queue set.item_cards(limit: 0) end end end |
#rule_set_keys ⇒ Object
61 62 63 |
# File 'tmpsets/set/mod002-core/all/pattern.rb', line 61 def rule_set_keys @rule_set_keys ||= patterns.map(&:rule_set_key).compact end |
#safe_set_keys ⇒ Object
35 36 37 |
# File 'tmpsets/set/mod002-core/all/pattern.rb', line 35 def safe_set_keys patterns.map(&:safe_key).reverse * " " end |
#set_format_modules(klass) ⇒ Object
44 45 46 47 48 49 50 |
# File 'tmpsets/set/mod002-core/all/pattern.rb', line 44 def set_format_modules klass @set_format_modules ||= {} @set_format_modules[klass] = patterns_without_new[0..-2].reverse.map do |pattern| pattern.format_module_list klass end.flatten.compact end |
#set_modules ⇒ Object
39 40 41 42 |
# File 'tmpsets/set/mod002-core/all/pattern.rb', line 39 def set_modules @set_modules ||= patterns_without_new[0..-2].reverse.map(&:module_list).flatten.compact end |
#set_names ⇒ Object
52 53 54 55 |
# File 'tmpsets/set/mod002-core/all/pattern.rb', line 52 def set_names @set_names = patterns.map(&:to_s) if @set_names.nil? @set_names end |