Module: Appom::ElementState::Monitoring
- Defined in:
- lib/appom/element_state.rb
Overview
Element state monitoring mixin
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
-
#current_state ⇒ Object
Get current state.
-
#track_state(name: nil, context: {}) ⇒ Object
Track this element’s state.
-
#update_state ⇒ Object
Update state and return changes.
-
#wait_for_state_change(**args) ⇒ Object
Wait for state change.
Class Method Details
.included(base) ⇒ Object
371 372 373 |
# File 'lib/appom/element_state.rb', line 371 def self.included(base) base.extend(ClassMethods) end |
Instance Method Details
#current_state ⇒ Object
Get current state
401 402 403 404 405 |
# File 'lib/appom/element_state.rb', line 401 def current_state return unless self.class.state_tracking_enabled? ::Appom::ElementState.tracker.element_state(element_id) if defined?(@element_id) end |
#track_state(name: nil, context: {}) ⇒ Object
Track this element’s state
387 388 389 390 391 |
# File 'lib/appom/element_state.rb', line 387 def track_state(name: nil, context: {}) return unless self.class.state_tracking_enabled? ::Appom::ElementState.tracker.track_element(self, name: name, context: context) end |
#update_state ⇒ Object
Update state and return changes
394 395 396 397 398 |
# File 'lib/appom/element_state.rb', line 394 def update_state return unless self.class.state_tracking_enabled? ::Appom::ElementState.tracker.update_element_state(element_id) if defined?(@element_id) end |
#wait_for_state_change(**args) ⇒ Object
Wait for state change
408 409 410 411 412 |
# File 'lib/appom/element_state.rb', line 408 def wait_for_state_change(**args) return unless self.class.state_tracking_enabled? ::Appom::ElementState.tracker.wait_for_state_change(element_id, args.empty? ? {} : args) if defined?(@element_id) end |