Class: GooseGame::Dice
- Inherits:
-
Object
- Object
- GooseGame::Dice
- Defined in:
- lib/goose_game/dice.rb
Constant Summary collapse
- QTY =
2- MAX =
6
Instance Attribute Summary collapse
-
#d1 ⇒ Object
readonly
Returns the value of attribute d1.
-
#d2 ⇒ Object
readonly
Returns the value of attribute d2.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(d1 = 0, d2 = 0) ⇒ Dice
constructor
A new instance of Dice.
- #to_i ⇒ Object
Constructor Details
#initialize(d1 = 0, d2 = 0) ⇒ Dice
Returns a new instance of Dice.
12 13 14 |
# File 'lib/goose_game/dice.rb', line 12 def initialize(d1 = 0, d2 = 0) @d1, @d2 = *check_args(d1, d2) end |
Instance Attribute Details
#d1 ⇒ Object (readonly)
Returns the value of attribute d1.
6 7 8 |
# File 'lib/goose_game/dice.rb', line 6 def d1 @d1 end |
#d2 ⇒ Object (readonly)
Returns the value of attribute d2.
6 7 8 |
# File 'lib/goose_game/dice.rb', line 6 def d2 @d2 end |
Class Method Details
Instance Method Details
#to_i ⇒ Object
16 17 18 |
# File 'lib/goose_game/dice.rb', line 16 def to_i [d1, d2].sum end |