Class: Lightswitch::StateChange
- Inherits:
-
Object
- Object
- Lightswitch::StateChange
- Defined in:
- lib/lightswitch/schedule_mixins.rb
Instance Attribute Summary collapse
-
#at_time ⇒ Object
Returns the value of attribute at_time.
-
#state ⇒ Object
Returns the value of attribute state.
Instance Method Summary collapse
- #equal?(other) ⇒ Boolean
-
#initialize(state_string, at_time) ⇒ StateChange
constructor
A new instance of StateChange.
- #to_h ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(state_string, at_time) ⇒ StateChange
Returns a new instance of StateChange.
44 45 46 |
# File 'lib/lightswitch/schedule_mixins.rb', line 44 def initialize(state_string, at_time) @state, @at_time = state_string, at_time end |
Instance Attribute Details
#at_time ⇒ Object
Returns the value of attribute at_time.
42 43 44 |
# File 'lib/lightswitch/schedule_mixins.rb', line 42 def at_time @at_time end |
#state ⇒ Object
Returns the value of attribute state.
42 43 44 |
# File 'lib/lightswitch/schedule_mixins.rb', line 42 def state @state end |
Instance Method Details
#equal?(other) ⇒ Boolean
54 55 56 |
# File 'lib/lightswitch/schedule_mixins.rb', line 54 def equal?(other) other.is_a? StateChange and (other.state == state and other.at_time == at_time) end |
#to_h ⇒ Object
48 49 50 |
# File 'lib/lightswitch/schedule_mixins.rb', line 48 def to_h {state: state, at_time: at_time} end |
#to_s ⇒ Object
52 |
# File 'lib/lightswitch/schedule_mixins.rb', line 52 def to_s; "State change to #{state} at #{at_time}"; end |