Module: Card::Set::All::Pattern

Extended by:
Card::Set
Defined in:
card/tmpsets/set/mod002-core/all/pattern.rb

Overview

Set: All cards (Pattern)

Constant Summary

Constants included from Helpers

Helpers::SET_PATTERN_TEST_REGEXP

Constants included from Event::Api

Event::Api::OPTIONS

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Card::Set

reset_modules

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

#method_missing, #num_set_parts, #pattern_code, #respond_to_missing?, #set_name_parts, #shortname, #underscore

Methods included from Card::Set::AdvancedApi

#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 Basket

#abstract_basket, #add_to_basket, #basket, #unshift_basket

Methods included from Trait

#card_accessor, #card_reader, #card_writer, #require_field

Methods included from Event::Api

#event

Class Method Details

.source_locationObject



7
# File 'card/tmpsets/set/mod002-core/all/pattern.rb', line 7

def self.source_location; "/Users/ethan/dev/decko/gem/card/mod/core/set/all/pattern.rb"; end

Instance Method Details

#all_patternsObject



12
13
14
# File 'card/tmpsets/set/mod002-core/all/pattern.rb', line 12

def all_patterns
  @all_patterns ||= set_patterns.map { |sub| sub.new self }.compact
end

#in_set?(set_module) ⇒ Boolean

Returns:

  • (Boolean)


51
52
53
# File 'card/tmpsets/set/mod002-core/all/pattern.rb', line 51

def in_set? set_module
  patterns.map(&:module_key).include? set_module.shortname
end

#include_module?(set) ⇒ Boolean

Returns:

  • (Boolean)


59
60
61
# File 'card/tmpsets/set/mod002-core/all/pattern.rb', line 59

def include_module? set
  singleton_class&.include? set
end

#patternsObject

new cards do not



17
18
19
# File 'card/tmpsets/set/mod002-core/all/pattern.rb', line 17

def patterns
  @patterns ||= (new_card? ? all_patterns[1..-1] : all_patterns)
end

#patterns?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'card/tmpsets/set/mod002-core/all/pattern.rb', line 8

def patterns?
  defined? @patterns
end

#reset_patternsObject



21
22
23
24
25
26
27
28
# File 'card/tmpsets/set/mod002-core/all/pattern.rb', line 21

def reset_patterns
  # Rails.logger.info "resetting patterns: #{name}"
  @patterns = @all_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

#rule_set_keysObject



55
56
57
# File 'card/tmpsets/set/mod002-core/all/pattern.rb', line 55

def rule_set_keys
  @rule_set_keys ||= patterns.map(&:rule_set_key).compact
end

#safe_set_keysObject



30
31
32
# File 'card/tmpsets/set/mod002-core/all/pattern.rb', line 30

def safe_set_keys
  patterns.map(&:safe_key).reverse * " "
end

#set_format_modules(klass) ⇒ Object



38
39
40
41
42
43
44
# File 'card/tmpsets/set/mod002-core/all/pattern.rb', line 38

def set_format_modules klass
  @set_format_modules ||= {}
  @set_format_modules[klass] =
    all_patterns[0..-2].reverse.map do |pattern|
      pattern.format_module_list klass
    end.flatten.compact
end

#set_modulesObject



34
35
36
# File 'card/tmpsets/set/mod002-core/all/pattern.rb', line 34

def set_modules
  @set_modules ||= all_patterns[0..-2].reverse.map(&:module_list).flatten.compact
end

#set_namesObject



46
47
48
49
# File 'card/tmpsets/set/mod002-core/all/pattern.rb', line 46

def set_names
  @set_names = patterns.map(&:to_s) if @set_names.nil?
  @set_names
end