Class: LightMeUp::Light
- Inherits:
-
Object
- Object
- LightMeUp::Light
- Defined in:
- lib/light_me_up/light.rb
Constant Summary collapse
- BRIGHTNESS_RANGE =
(0..100).freeze
- TEMPERATURE_RANGE =
(0..100).freeze
Instance Attribute Summary collapse
-
#brightness ⇒ Object
readonly
Returns the value of attribute brightness.
-
#on ⇒ Object
readonly
Returns the value of attribute on.
-
#temperature ⇒ Object
readonly
Returns the value of attribute temperature.
Class Method Summary collapse
- .max_brightness ⇒ Object
- .max_temperature ⇒ Object
- .min_brightness ⇒ Object
- .min_temperature ⇒ Object
Instance Method Summary collapse
-
#initialize(on: nil, brightness: nil, temperature: nil) ⇒ Light
constructor
A new instance of Light.
Constructor Details
#initialize(on: nil, brightness: nil, temperature: nil) ⇒ Light
Returns a new instance of Light.
28 29 30 31 32 33 34 35 |
# File 'lib/light_me_up/light.rb', line 28 def initialize(on: nil, brightness: nil, temperature: nil) validate_brightness(brightness) validate_temperature(temperature) @on = on @brightness = brightness @temperature = temperature end |
Instance Attribute Details
#brightness ⇒ Object (readonly)
Returns the value of attribute brightness.
5 6 7 |
# File 'lib/light_me_up/light.rb', line 5 def brightness @brightness end |
#on ⇒ Object (readonly)
Returns the value of attribute on.
5 6 7 |
# File 'lib/light_me_up/light.rb', line 5 def on @on end |
#temperature ⇒ Object (readonly)
Returns the value of attribute temperature.
5 6 7 |
# File 'lib/light_me_up/light.rb', line 5 def temperature @temperature end |
Class Method Details
.max_brightness ⇒ Object
11 12 13 |
# File 'lib/light_me_up/light.rb', line 11 def max_brightness BRIGHTNESS_RANGE.last end |
.max_temperature ⇒ Object
19 20 21 |
# File 'lib/light_me_up/light.rb', line 19 def max_temperature TEMPERATURE_RANGE.last end |
.min_brightness ⇒ Object
15 16 17 |
# File 'lib/light_me_up/light.rb', line 15 def min_brightness BRIGHTNESS_RANGE.first end |
.min_temperature ⇒ Object
23 24 25 |
# File 'lib/light_me_up/light.rb', line 23 def min_temperature TEMPERATURE_RANGE.first end |