Sha256: 6bd82756f3a190a59ecd5f8b9864b939c0b5a3aeb436e1e7567d37d9561c8778

Contents?: true

Size: 909 Bytes

Versions: 7

Compression:

Stored size: 909 Bytes

Contents

# -*- encoding : utf-8 -*-
require 'smart_name'


class Card
  class Name < SmartName

    self.params  = Wagn::Env # yuck!
    self.session = proc { Account.current.name }
    self.banned_array = ['/']

    def star?
      simple? and '*' == s[0,1]
    end

    def rstar?
      right and '*' == right[0,1]
    end

    def trait_name? *traitlist
      junction? && begin
        right_key = right_name.key
        !!traitlist.find do |codename|
          card_id = Card::Codename[ codename ] and card = Card.fetch( card_id, :skip_modules=>true, :skip_virtual=>true ) and
            card.key == right_key
        end
      end
    end

    def trait_name tag_code
      card_id = Card::Codename[ tag_code ] and card = Card.fetch( card_id, :skip_modules=>true, :skip_virtual=>true ) and
        [ self, card.cardname ].to_name
    end

    def trait tag_code
      trait_name( tag_code ).s
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
wagn-1.12.13 lib/card/name.rb
wagn-1.12.12 lib/card/name.rb
wagn-1.12.11 lib/card/name.rb
wagn-1.12.10 lib/card/name.rb
wagn-1.12.9 lib/card/name.rb
wagn-1.12.8 lib/card/name.rb
wagn-1.12.7 lib/card/name.rb