Module: Appium::Core::Base::Device::Context
- Included in:
- Bridge
- Defined in:
- lib/appium_lib_core/common/device/context.rb,
sig/lib/appium_lib_core/common/device/context.rbs
Instance Method Summary collapse
- #available_contexts ⇒ Object
- #current_context ⇒ Object
- #execute ⇒ Object
- #set_context(context = nil) ⇒ Object
- #within_context(context) ⇒ void
Instance Method Details
#available_contexts ⇒ Object
34 35 36 37 |
# File 'lib/appium_lib_core/common/device/context.rb', line 34 def available_contexts # return empty array instead of nil on failure execute(:available_contexts, {}) || [] end |
#current_context ⇒ Object
30 31 32 |
# File 'lib/appium_lib_core/common/device/context.rb', line 30 def current_context execute :current_context end |
#execute ⇒ Object
14 |
# File 'sig/lib/appium_lib_core/common/device/context.rbs', line 14 def execute: (Symbol command, ?Hash[untyped, untyped], ?Hash[untyped, untyped]) -> untyped |
#set_context(context = nil) ⇒ Object
39 40 41 |
# File 'lib/appium_lib_core/common/device/context.rb', line 39 def set_context(context = nil) execute :set_context, {}, name: context end |
#within_context(context) ⇒ void
This method returns an undefined value.
20 21 22 23 24 25 26 27 28 |
# File 'lib/appium_lib_core/common/device/context.rb', line 20 def within_context(context) existing_context = current_context set_context context begin yield if block_given? ensure set_context existing_context end end |