Class: CardTypeAggregate
- Inherits:
-
Object
- Object
- CardTypeAggregate
- Defined in:
- lib/manasimu/card.rb
Instance Method Summary collapse
- #add(card_type) ⇒ Object
- #each ⇒ Object
- #find(set_code, number) ⇒ Object
-
#initialize ⇒ CardTypeAggregate
constructor
A new instance of CardTypeAggregate.
- #map ⇒ Object
Constructor Details
#initialize ⇒ CardTypeAggregate
Returns a new instance of CardTypeAggregate.
398 399 400 |
# File 'lib/manasimu/card.rb', line 398 def initialize @memo = [] end |
Instance Method Details
#add(card_type) ⇒ Object
418 419 420 |
# File 'lib/manasimu/card.rb', line 418 def add(card_type) @memo << card_type end |
#each ⇒ Object
422 423 424 425 426 427 |
# File 'lib/manasimu/card.rb', line 422 def each return if not @memo @memo.each do |item| yield item end end |
#find(set_code, number) ⇒ Object
402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 |
# File 'lib/manasimu/card.rb', line 402 def find(set_code, number) ret = @memo.bsearch do |c| a = c.contents[0] if set_code == a.set_code number.to_i <= a.number else set_code < a.set_code end end if ret and ret.set_code == set_code and ret.number == number.to_i ret else nil end end |
#map ⇒ Object
429 430 431 432 433 |
# File 'lib/manasimu/card.rb', line 429 def map @memo.map do |item| yield item end end |