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)


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

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

#all_set?Boolean

Returns:

  • (Boolean)


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

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

#shortnameObject



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/card/set/helpers.rb', line 4

def shortname
  parts = name.split "::"
  first = 2 # shortname eliminates Card::Set
  pattern_name = parts[first].underscore
  last = if pattern_name == "abstract"
           first + 1
         else
           set_class = Pattern.find pattern_name
           first + set_class.anchor_parts_count
         end
  parts[first..last].join "::"
end