Class: StartingHandRepository

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/rora/repository/starting_hand_repository.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeStartingHandRepository

Returns a new instance of StartingHandRepository.



5
6
7
8
9
10
11
12
13
# File 'lib/rora/repository/starting_hand_repository.rb', line 5

def initialize
  @all = Array.new
  @distinct = Hash.new
  Deck.new.cards.combination(2) do |combination|
    starting_hand = StartingHand.new(combination)
    @all << starting_hand
    @distinct[starting_hand.key] = starting_hand
  end
end

Instance Attribute Details

#allObject (readonly)

Returns the value of attribute all.



3
4
5
# File 'lib/rora/repository/starting_hand_repository.rb', line 3

def all
  @all
end

#distinctObject (readonly)

Returns the value of attribute distinct.



3
4
5
# File 'lib/rora/repository/starting_hand_repository.rb', line 3

def distinct
  @distinct
end

Instance Method Details

#all_starting_handsObject



15
16
17
# File 'lib/rora/repository/starting_hand_repository.rb', line 15

def all_starting_hands
  @all
end

#distinct_starting_handsObject



19
20
21
# File 'lib/rora/repository/starting_hand_repository.rb', line 19

def distinct_starting_hands
  @distinct.values
end