Class: Forecastr::Wind

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

Constant Summary collapse

DIRECTIONS =
["N","NNE","NE","ENE","E","ESE", "SE", "SSE","S","SSW","SW","WSW","W","WNW","NW","NNW"]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(speed, angle) ⇒ Wind

Returns a new instance of Wind.



7
8
9
10
# File 'lib/forecastr/wind.rb', line 7

def initialize(speed, angle)
  @speed = speed
  @angle = angle
end

Instance Attribute Details

#directionObject (readonly)

Returns the value of attribute direction.



5
6
7
# File 'lib/forecastr/wind.rb', line 5

def direction
  @direction
end

#speedObject (readonly)

Returns the value of attribute speed.



5
6
7
# File 'lib/forecastr/wind.rb', line 5

def speed
  @speed
end

Instance Method Details

#to_sObject



21
22
23
# File 'lib/forecastr/wind.rb', line 21

def to_s
  "#{speed} #{direction}"
end