Class: Card::Set::Pattern

Inherits:
Object show all
Defined in:
card/lib/card/set/pattern.rb,
card/lib/card/set/pattern/all.rb,
card/lib/card/set/pattern/base.rb,
card/lib/card/set/pattern/class_methods.rb

Defined Under Namespace

Modules: All, ClassMethods Classes: Base

Class Method Summary collapse

Class Method Details

.card_keysObject



27
28
29
30
31
32
33
# File 'card/lib/card/set/pattern.rb', line 27

def card_keys
  @card_keys ||=
    Card.set_patterns.each_with_object({}) do |set_pattern, hash|
      card_key = Card.quick_fetch(set_pattern.pattern_code).key
      hash[card_key] = true
    end
end

.find(pattern_code) ⇒ Object



23
24
25
# File 'card/lib/card/set/pattern.rb', line 23

def find pattern_code
  Card.set_patterns.find { |sub| sub.pattern_code == pattern_code }
end

.loadable_codesObject



41
42
43
# File 'card/lib/card/set/pattern.rb', line 41

def loadable_codes
  Card.set_patterns.map(&:pattern_code).push(:abstract).reverse
end

.loadablesObject



13
14
15
# File 'card/lib/card/set/pattern.rb', line 13

def loadables
  Card.set_patterns.push(Card::Set::Abstract).reverse
end

.nonbase_loadable_codesObject



35
36
37
38
39
# File 'card/lib/card/set/pattern.rb', line 35

def nonbase_loadable_codes
  l = loadable_codes
  l.delete :all
  l
end

.nonbase_loadablesObject



17
18
19
20
21
# File 'card/lib/card/set/pattern.rb', line 17

def nonbase_loadables
  l = loadables
  l.delete Card::Set::All
  l
end

.resetObject



5
6
7
8
9
10
11
# File 'card/lib/card/set/pattern.rb', line 5

def reset
  nonbase_loadables.each do |set_pattern|
    Card::Set.const_remove_if_defined set_pattern.to_s.split("::").last
  end
  Card.set_patterns = []
  @card_keys = nil
end