class Forecastr::Wind

Constants

DIRECTIONS

Public Class Methods

new(speed, angle) click to toggle source
# File lib/forecastr/wind.rb, line 5
def initialize(speed, angle)
  @speed = speed
  @angle = angle
end

Public Instance Methods

direction() click to toggle source
# File lib/forecastr/wind.rb, line 14
def direction
  val = ((@angle/22.5) + 0.5).to_i
  DIRECTIONS[val % 16]
end
speed() click to toggle source
# File lib/forecastr/wind.rb, line 10
def speed
  "#{@speed} m/s"
end
to_s() click to toggle source
# File lib/forecastr/wind.rb, line 19
def to_s
  "#{speed} #{direction}"
end