def print(val)
      if @options[:humidity] then
        puts sprintf("Humidity: %.2f%%", val.humidity)
        return
      end

      if @options[:unit] == :c then
        if @options[:temperature] then
          puts sprintf("Temperature: %.2f C", val.temp)
        else
          puts sprintf("Temperature: %.2f C Humidity: %.2f%%", val.temp, val.humidity)
        end
      else
        if @options[:temperature] then
          puts sprintf("Temperature: %.2f F", val.temp_f, val.humidity)
        else
          puts sprintf("Temperature: %.2f F Humidity: %.2f%%", val.temp_f, val.humidity)
        end
      end
    end
def print(val)
      if @options[:humidity] then
        puts sprintf("Humidity: %.2f%%", val.humidity)
        return
      end

      if @options[:unit] == :c then
        if @options[:temperature] then
          puts sprintf("Temperature: %.2f C", val.temp)
        else
          puts sprintf("Temperature: %.2f C Humidity: %.2f%%", val.temp, val.humidity)
        end
      else
        if @options[:temperature] then
          puts sprintf("Temperature: %.2f F", val.temp_f, val.humidity)
        else
          puts sprintf("Temperature: %.2f F Humidity: %.2f%%", val.temp_f, val.humidity)
        end
      end
    end
def print ( val ) if @options [ :humidity ] then puts sprintf ( "Humidity: %.2f%%" , val . humidity ) return end if @options [ :unit ] == :c then if @options [ :temperature ] then puts sprintf ( "Temperature: %.2f C" , val . temp ) else puts sprintf ( "Temperature: %.2f C Humidity: %.2f%%" , val . temp , val . humidity ) end else if @options [ :temperature ] then puts sprintf ( "Temperature: %.2f F" , val . temp_f , val . humidity ) else puts sprintf ( "Temperature: %.2f F Humidity: %.2f%%" , val . temp_f , val . humidity ) end end end
Print to stdout, taking the various output options into account
Print to stdout taking the various output options into account