Class: Purse
- Inherits:
-
Object
- Object
- Purse
- Defined in:
- lib/purse.rb
Instance Attribute Summary collapse
-
#bag ⇒ Object
readonly
Returns the value of attribute bag.
Instance Method Summary collapse
-
#initialize(board) ⇒ Purse
constructor
A new instance of Purse.
- #pick ⇒ Object
Constructor Details
#initialize(board) ⇒ Purse
Returns a new instance of Purse.
4 5 6 7 8 9 |
# File 'lib/purse.rb', line 4 def initialize(board) @board = board @bag = [] @seen = Set.new fill(7) end |
Instance Attribute Details
#bag ⇒ Object (readonly)
Returns the value of attribute bag.
2 3 4 |
# File 'lib/purse.rb', line 2 def bag @bag end |
Instance Method Details
#pick ⇒ Object
11 12 13 |
# File 'lib/purse.rb', line 11 def pick @bag.pop.tap { fill } end |