Class: Wind

Inherits:
Object
  • Object
show all
Defined in:
lib/wind.rb

Constant Summary collapse

DIRECTIONS =
[:N, :NE, :E, :SE, :S, :SW, :W, :NW]

Instance Method Summary collapse

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_sObject



10
11
12
# File 'lib/wind.rb', line 10

def to_s
  @speed.to_s + @direction.to_s
end