Sha256: ae5a125c4a35f2b200028745dfabea1af783d8fe36268be37d8c896cce57d86b

Contents?: true

Size: 636 Bytes

Versions: 32

Compression:

Stored size: 636 Bytes

Contents

class Card
  module Set
    module Helpers
      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

      # move to Set::Pattern?
      def num_set_parts pattern_code
        return 1 if pattern_code == :abstract
        Pattern.find(pattern_code).anchor_parts_count
      end

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

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

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
card-1.96.8 lib/card/set/helpers.rb
card-1.96.7 lib/card/set/helpers.rb
card-1.96.6 lib/card/set/helpers.rb
card-1.96.5 lib/card/set/helpers.rb
card-1.96.4 lib/card/set/helpers.rb
card-1.96.3 lib/card/set/helpers.rb
card-1.96.2 lib/card/set/helpers.rb
card-1.96.1 lib/card/set/helpers.rb
card-1.96.0 lib/card/set/helpers.rb
card-1.95.3 lib/card/set/helpers.rb
card-1.95.2 lib/card/set/helpers.rb
card-1.95.1 lib/card/set/helpers.rb
card-1.95.0 lib/card/set/helpers.rb
card-1.94.1 lib/card/set/helpers.rb
card-1.94.0 lib/card/set/helpers.rb
card-1.93.13 lib/card/set/helpers.rb
card-1.93.12 lib/card/set/helpers.rb
card-1.93.11 lib/card/set/helpers.rb
card-1.93.10 lib/card/set/helpers.rb
card-1.93.9 lib/card/set/helpers.rb