Class: CardTypeAggregate

Inherits:
Object
  • Object
show all
Defined in:
lib/manasimu/card.rb

Instance Method Summary collapse

Instance Method Details

#eachObject



265
266
267
268
269
270
# File 'lib/manasimu/card.rb', line 265

def each
  return if not @memo
  @memo.each do |item|
    yield item
  end
end

#find(card_type) ⇒ Object



249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
# File 'lib/manasimu/card.rb', line 249

def find(card_type)
  @memo ||= []
  return nil if not card_type
  singleton = @memo.find do |c|
    a = c.contents[0]
    b = card_type.contents[0]
    a and b and a.name == b.name
  end
  if singleton
    singleton
  else
    @memo << card_type
    card_type
  end
end