Class: CIAT::TrafficLight
- Inherits:
-
Object
- Object
- CIAT::TrafficLight
- Defined in:
- lib/ciat/traffic_light.rb
Constant Summary collapse
- GREEN =
CIAT::TrafficLight.new(:green)
- RED =
CIAT::TrafficLight.new(:red)
- YELLOW =
CIAT::TrafficLight.new(:yellow)
- UNSET =
CIAT::TrafficLight.new(:unset)
- UNNEEDED =
CIAT::TrafficLight.new(:unneeded)
Instance Method Summary collapse
- #color ⇒ Object
- #green? ⇒ Boolean
-
#initialize(setting) ⇒ TrafficLight
constructor
:nodoc:.
- #red? ⇒ Boolean
- #unneeded? ⇒ Boolean
- #unset? ⇒ Boolean
- #yellow? ⇒ Boolean
Constructor Details
#initialize(setting) ⇒ TrafficLight
:nodoc:
3 4 5 |
# File 'lib/ciat/traffic_light.rb', line 3 def initialize(setting) #:nodoc: @setting = setting end |
Instance Method Details
#color ⇒ Object
33 34 35 |
# File 'lib/ciat/traffic_light.rb', line 33 def color @setting.to_s end |
#green? ⇒ Boolean
17 18 19 |
# File 'lib/ciat/traffic_light.rb', line 17 def green? @setting == :green end |
#red? ⇒ Boolean
25 26 27 |
# File 'lib/ciat/traffic_light.rb', line 25 def red? @setting == :red end |
#unneeded? ⇒ Boolean
29 30 31 |
# File 'lib/ciat/traffic_light.rb', line 29 def unneeded? @setting == :unneeded end |
#unset? ⇒ Boolean
13 14 15 |
# File 'lib/ciat/traffic_light.rb', line 13 def unset? @setting == :unset end |
#yellow? ⇒ Boolean
21 22 23 |
# File 'lib/ciat/traffic_light.rb', line 21 def yellow? @setting == :yellow end |