Module: LibWebSocket::Stateful
- Included in:
- Message
- Defined in:
- lib/libwebsocket/stateful.rb
Overview
Base class for all classes with states
Instance Attribute Summary collapse
-
#state ⇒ Object
Returns the value of attribute state.
Instance Method Summary collapse
-
#done ⇒ Object
Change state to ‘done’.
-
#done? ⇒ Boolean
Check if current state is done.
-
#state?(val) ⇒ Boolean
Return true if current state match given state.
Instance Attribute Details
#state ⇒ Object
Returns the value of attribute state.
5 6 7 |
# File 'lib/libwebsocket/stateful.rb', line 5 def state @state end |
Instance Method Details
#done ⇒ Object
Change state to ‘done’
13 14 15 16 |
# File 'lib/libwebsocket/stateful.rb', line 13 def done @state = 'done' true end |
#done? ⇒ Boolean
Check if current state is done
19 20 21 |
# File 'lib/libwebsocket/stateful.rb', line 19 def done? @state == 'done' end |
#state?(val) ⇒ Boolean
Return true if current state match given state
8 9 10 |
# File 'lib/libwebsocket/stateful.rb', line 8 def state?(val) @state == val end |