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

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

Overview

Set: All cards (Pattern)

Constant Summary

Constants included from Helpers

Helpers::SET_PATTERN_TEST_REGEXP

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, #ensure_set, #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 'tmpsets/set/mod003-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

#in_set?(set_module) ⇒ Boolean

Returns:

  • (Boolean)


56
57
58
# File 'tmpsets/set/mod003-core/all/pattern.rb', line 56

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

#patternsObject



9
10
11
# File 'tmpsets/set/mod003-core/all/pattern.rb', line 9

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

#patterns_with_newObject



13
14
15
# File 'tmpsets/set/mod003-core/all/pattern.rb', line 13

def patterns_with_new
  new_card? ? patterns_without_new[1..-1] : patterns_without_new
end

#reset_patternsObject



18
19
20
21
22
23
24
# File 'tmpsets/set/mod003-core/all/pattern.rb', line 18

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



26
27
28
29
30
31
32
# File 'tmpsets/set/mod003-core/all/pattern.rb', line 26

def reset_patterns_if_rule _saving=false
  return unless real? && is_rule? && (set = left)

  set.reset_patterns
  set.include_set_modules
  set
end

#rule_set_keysObject



60
61
62
# File 'tmpsets/set/mod003-core/all/pattern.rb', line 60

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

#safe_set_keysObject



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

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

#set_format_modules(klass) ⇒ Object



43
44
45
46
47
48
49
# File 'tmpsets/set/mod003-core/all/pattern.rb', line 43

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_modulesObject



38
39
40
41
# File 'tmpsets/set/mod003-core/all/pattern.rb', line 38

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

#set_namesObject



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

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