class Cards
Attributes
game[RW]
side[RW]
Public Instance Methods
<<(c)
click to toggle source
# File lib/ascension/cards.rb, line 8 def <<(c) cards << c end
[](i)
click to toggle source
# File lib/ascension/cards.rb, line 49 def [](i) cards[i] end
[]=(i,card)
click to toggle source
# File lib/ascension/cards.rb, line 46 def []=(i,card) cards[i] = card end
banish(card)
click to toggle source
# File lib/ascension/cards.rb, line 42 def banish(card) remove(card) game.void << card end
clear!()
click to toggle source
# File lib/ascension/cards.rb, line 36 def clear! self.cards = [] end
each(&b)
click to toggle source
# File lib/ascension/cards.rb, line 15 def each(&b) cards.each(&b) end
empty?()
click to toggle source
# File lib/ascension/cards.rb, line 21 def empty? size == 0 end
first()
click to toggle source
# File lib/ascension/cards.rb, line 27 def first cards.first end
get_one(name)
click to toggle source
# File lib/ascension/cards.rb, line 55 def get_one(name) res = find { |x| x.name == name } raise "couldn't find #{name}" unless res self.cards -= [res] res end
hydrate!()
click to toggle source
# File lib/ascension/cards.rb, line 61 def hydrate! self.cards = map { |x| x.hydrated } end
include?(c)
click to toggle source
# File lib/ascension/cards.rb, line 39 def include?(c) cards.include?(c) end
index(obj)
click to toggle source
# File lib/ascension/cards.rb, line 33 def index(obj) cards.index(obj) end
pop()
click to toggle source
# File lib/ascension/cards.rb, line 30 def pop cards.pop end
remove(c)
click to toggle source
# File lib/ascension/cards.rb, line 11 def remove(c) raise "#{c} not here" unless cards.include?(c) self.cards -= [c] end
shuffle!()
click to toggle source
# File lib/ascension/cards.rb, line 18 def shuffle! self.cards = cards.sort_by { |x| rand() } end
size()
click to toggle source
# File lib/ascension/cards.rb, line 24 def size cards.size end
to_s_cards()
click to toggle source
# File lib/ascension/cards.rb, line 52 def to_s_cards map { |x| x.name }.join(" | ") end