Class: Accuweather::Conditions::Units

Inherits:
Object
  • Object
show all
Defined in:
lib/accuweather/conditions/units.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(temp:, dist:, speed:, pres:, prec:) ⇒ Units

Returns a new instance of Units.



6
7
8
9
10
11
12
# File 'lib/accuweather/conditions/units.rb', line 6

def initialize(temp:, dist:, speed:, pres:, prec:)
  @temp = temp
  @dist = dist
  @speed = speed
  @pres = pres
  @prec = prec
end

Instance Attribute Details

#distObject (readonly)

Returns the value of attribute dist.



4
5
6
# File 'lib/accuweather/conditions/units.rb', line 4

def dist
  @dist
end

#precObject (readonly)

Returns the value of attribute prec.



4
5
6
# File 'lib/accuweather/conditions/units.rb', line 4

def prec
  @prec
end

#presObject (readonly)

Returns the value of attribute pres.



4
5
6
# File 'lib/accuweather/conditions/units.rb', line 4

def pres
  @pres
end

#speedObject (readonly)

Returns the value of attribute speed.



4
5
6
# File 'lib/accuweather/conditions/units.rb', line 4

def speed
  @speed
end

#tempObject (readonly)

Returns the value of attribute temp.



4
5
6
# File 'lib/accuweather/conditions/units.rb', line 4

def temp
  @temp
end

Instance Method Details

#==(other) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/accuweather/conditions/units.rb', line 14

def ==(other)
  temp == other.temp &&
    dist == other.dist &&
    speed == other.speed &&
    pres == other.pres &&
    prec == other.prec
rescue NoMethodError
  false
end

#to_sObject



24
25
26
# File 'lib/accuweather/conditions/units.rb', line 24

def to_s
  "temp: #{temp}, dist: #{dist}, speed: #{speed}, pres: #{pres}, prec: #{prec}"
end