Class: StartingHandRepository
- Inherits:
-
Object
- Object
- StartingHandRepository
- Includes:
- Singleton
- Defined in:
- lib/rora/repository/starting_hand_repository.rb
Instance Attribute Summary collapse
-
#all ⇒ Object
readonly
Returns the value of attribute all.
-
#distinct ⇒ Object
readonly
Returns the value of attribute distinct.
Instance Method Summary collapse
- #all_starting_hands ⇒ Object
- #distinct_starting_hands ⇒ Object
-
#initialize ⇒ StartingHandRepository
constructor
A new instance of StartingHandRepository.
Constructor Details
#initialize ⇒ StartingHandRepository
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
#all ⇒ Object (readonly)
Returns the value of attribute all.
3 4 5 |
# File 'lib/rora/repository/starting_hand_repository.rb', line 3 def all @all end |
#distinct ⇒ Object (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_hands ⇒ Object
15 16 17 |
# File 'lib/rora/repository/starting_hand_repository.rb', line 15 def all_starting_hands @all end |
#distinct_starting_hands ⇒ Object
19 20 21 |
# File 'lib/rora/repository/starting_hand_repository.rb', line 19 def distinct_starting_hands @distinct.values end |