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(temperature:, distance:, speed:, pressure:, precipitation:) ⇒ Units

Returns a new instance of Units.



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

def initialize(temperature:, distance:, speed:, pressure:, precipitation:)
  @temperature = temperature
  @distance = distance
  @speed = speed
  @pressure = pressure
  @precipitation = precipitation
end

Instance Attribute Details

#distanceObject (readonly)

Returns the value of attribute distance.



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

def distance
  @distance
end

#precipitationObject (readonly)

Returns the value of attribute precipitation.



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

def precipitation
  @precipitation
end

#pressureObject (readonly)

Returns the value of attribute pressure.



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

def pressure
  @pressure
end

#speedObject (readonly)

Returns the value of attribute speed.



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

def speed
  @speed
end

#temperatureObject (readonly)

Returns the value of attribute temperature.



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

def temperature
  @temperature
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)
  temperature == other.temperature &&
    distance == other.distance &&
    speed == other.speed &&
    pressure == other.pressure &&
    precipitation == other.precipitation
rescue NoMethodError
  false
end

#to_sObject



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

def to_s
  "temperature: #{temperature}, distance: #{distance}, speed: #{speed}, pressure: #{pressure}, precipitation: #{precipitation}"
end