class NationalWeather::Conditions
Attributes
summary[R]
values[R]
Public Class Methods
new(summary, values)
click to toggle source
# File lib/nationalweather/conditions.rb, line 8 def initialize(summary, values) @summary = summary @values = values end
Public Instance Methods
to_s()
click to toggle source
# File lib/nationalweather/conditions.rb, line 13 def to_s s = @summary vals = Array.new if @values != nil @values.each do |v| # TODO: handle "none" for intensity, ex: "patchy none fog" # TODO: handle "qualifier" if v.has_key?('additive') vals.push("#{v['additive']} #{v['coverage']} #{v['intensity']} #{v['weather-type']}") else vals.push("#{v['coverage']} #{v['intensity']} #{v['weather-type']}") end end s +' (' + vals.join(' ') + ')' else s end end