class DarkSky::Location::Current

Public Class Methods

new(location) click to toggle source

automatically called by `Location` @since 0.1.0 @param [Location] location where to get data from

# File lib/darksky-api/current.rb, line 7
def initialize(location)
  @location = location
end

Public Instance Methods

nearest_storm_bearing() click to toggle source

@example

location = DarkSky::Location.new [45, -90]
location.current.nearest_storm_bearing #=> nearest storm bearing at location

@since 0.1.0 @return [Numeric] nearest storm bearing at location

# File lib/darksky-api/current.rb, line 16
def nearest_storm_bearing
  data[:nearestStormBearing]
end
nearest_storm_bearing_text() click to toggle source

@example

location = DarkSky::Location.new [45, -90]
location.current.nearest_storm_bearing_text #=> text representation of bearing (N, NW, etc.)

@since 0.1.0 @return [String] text representation of bearing

# File lib/darksky-api/current.rb, line 25
def nearest_storm_bearing_text
  _bearing_text(nearest_storm_bearing)
end
nearest_storm_distance() click to toggle source

@example

location = DarkSky::Location.new [45, -90]
location.current.nearest_storm_distance #=> nearest storm distance from location

@since 0.1.0 @return [Numeric] nearest storm distance from location

# File lib/darksky-api/current.rb, line 34
def nearest_storm_distance
  data[:nearestStormDistance]
end
temperature() click to toggle source

@example

location = DarkSky::Location.new [45, -90]
location.current.temperature #=> temperature at location

@since 0.1.0 @return [Numeric] current temperature at location

# File lib/darksky-api/current.rb, line 43
def temperature
  data[:temperature]
end

Private Instance Methods

data() click to toggle source

helper to avoid typing this many times over @since 0.1.3 @return [Hash] full data for current time

# File lib/darksky-api/current.rb, line 52
def data
  @location.full_data[:currently]
end