Module: Card::Set::Helpers

Included in:
Card::Set
Defined in:
lib/card/set/helpers.rb

Instance Method Summary collapse

Instance Method Details

#abstract_set?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/card/set/helpers.rb', line 18

def abstract_set?
  name =~ /^Card::Set::Abstract::/
end

#all_set?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/card/set/helpers.rb', line 22

def all_set?
  name =~ /^Card::Set::All::/
end

#num_set_parts(pattern_code) ⇒ Object

move to Set::Pattern?



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

def num_set_parts pattern_code
  return 1 if pattern_code == :abstract
  Pattern.find(pattern_code).anchor_parts_count
end

#shortnameObject



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

def shortname
  parts = name.split "::"
  first = 2 # shortname eliminates Card::Set
  pattern_code = parts[first].underscore.to_sym
  last = first + num_set_parts(pattern_code)
  parts[first..last].join "::"
end