Class: Wind
- Inherits:
-
Object
- Object
- Wind
- Defined in:
- lib/wind.rb
Constant Summary collapse
- DIRECTIONS =
[:N, :NE, :E, :SE, :S, :SW, :W, :NW]
Instance Method Summary collapse
-
#initialize(dieroller) ⇒ Wind
constructor
A new instance of Wind.
- #to_s ⇒ Object
Constructor Details
#initialize(dieroller) ⇒ Wind
Returns a new instance of Wind.
5 6 7 8 |
# File 'lib/wind.rb', line 5 def initialize(dieroller) @speed = dieroller.roll(20, -1) @direction = DIRECTIONS[dieroller.roll(8, -1)] end |
Instance Method Details
#to_s ⇒ Object
10 11 12 |
# File 'lib/wind.rb', line 10 def to_s @speed.to_s + @direction.to_s end |