Module: Appium
- Defined in:
- lib/appium_lib_core/device.rb,
lib/appium_lib_core.rb,
lib/appium_lib_core/driver.rb,
lib/appium_lib_core/element.rb,
lib/appium_lib_core/version.rb,
lib/appium_lib_core/common/log.rb,
lib/appium_lib_core/ios/device.rb,
lib/appium_lib_core/common/wait.rb,
lib/appium_lib_core/mac2/bridge.rb,
lib/appium_lib_core/mac2/device.rb,
lib/appium_lib_core/common/error.rb,
lib/appium_lib_core/common/logger.rb,
lib/appium_lib_core/android/device.rb,
lib/appium_lib_core/common/command.rb,
lib/appium_lib_core/windows/bridge.rb,
lib/appium_lib_core/windows/device.rb,
lib/appium_lib_core/common/wait/timer.rb,
lib/appium_lib_core/common/base/bridge.rb,
lib/appium_lib_core/common/base/driver.rb,
lib/appium_lib_core/mac2/device/screen.rb,
lib/appium_lib_core/common/base/rotable.rb,
lib/appium_lib_core/common/ws/websocket.rb,
lib/appium_lib_core/ios/xcuitest/bridge.rb,
lib/appium_lib_core/ios/xcuitest/device.rb,
lib/appium_lib_core/common/base/platform.rb,
lib/appium_lib_core/common/device/device.rb,
lib/appium_lib_core/ios/device/clipboard.rb,
lib/appium_lib_core/android/device/screen.rb,
lib/appium_lib_core/common/device/context.rb,
lib/appium_lib_core/common/device/setting.rb,
lib/appium_lib_core/windows/device/screen.rb,
lib/appium_lib_core/android/device/network.rb,
lib/appium_lib_core/common/base/device_ime.rb,
lib/appium_lib_core/common/base/screenshot.rb,
lib/appium_lib_core/common/device/keyboard.rb,
lib/appium_lib_core/common/device/keyevent.rb,
lib/appium_lib_core/android/device/emulator.rb,
lib/appium_lib_core/android/espresso/bridge.rb,
lib/appium_lib_core/common/device/app_state.rb,
lib/appium_lib_core/android/device/clipboard.rb,
lib/appium_lib_core/common/base/capabilities.rb,
lib/appium_lib_core/common/base/has_location.rb,
lib/appium_lib_core/common/base/http_default.rb,
lib/appium_lib_core/common/base/remote_status.rb,
lib/appium_lib_core/common/device/device_lock.rb,
lib/appium_lib_core/common/device/ime_actions.rb,
lib/appium_lib_core/common/device/orientation.rb,
lib/appium_lib_core/android/device/performance.rb,
lib/appium_lib_core/ios/xcuitest/device/screen.rb,
lib/appium_lib_core/android/uiautomator1/bridge.rb,
lib/appium_lib_core/android/uiautomator2/bridge.rb,
lib/appium_lib_core/android/uiautomator2/device.rb,
lib/appium_lib_core/common/base/driver_settings.rb,
lib/appium_lib_core/common/device/screen_record.rb,
lib/appium_lib_core/ios/xcuitest/device/battery.rb,
lib/appium_lib_core/support/event_firing_bridge.rb,
lib/appium_lib_core/common/device/app_management.rb,
lib/appium_lib_core/common/device/battery_status.rb,
lib/appium_lib_core/common/device/execute_driver.rb,
lib/appium_lib_core/common/device/file_management.rb,
lib/appium_lib_core/common/device/image_comparison.rb,
lib/appium_lib_core/ios/xcuitest/device/performance.rb,
lib/appium_lib_core/android/device/auth_finger_print.rb,
lib/appium_lib_core/common/base/has_network_connection.rb,
lib/appium_lib_core/android/uiautomator2/device/battery.rb,
lib/appium_lib_core/common/device/clipboard_content_type.rb
Overview
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Defined Under Namespace
Modules: Core, Logger, Support Classes: Location
Class Method Summary collapse
-
.symbolize_keys(hash, nested: false, enable_deprecation_msg: true) ⇒ Object
convert the top level keys to symbols.
Class Method Details
.symbolize_keys(hash, nested: false, enable_deprecation_msg: true) ⇒ Object
convert the top level keys to symbols.
opts = Appium.symbolize_keys(opts)
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/appium_lib_core.rb', line 32 def self.symbolize_keys(hash, nested: false, enable_deprecation_msg: true) # FIXME: As https://github.com/appium/ruby_lib/issues/945, we must remove this implicit string to symbol. # But appium_lib_core's some capability handling expect to be symbol, so we should test to remove # the methods which expect the symbol first. raise ::Appium::Core::Error::ArgumentError, 'symbolize_keys requires a hash' unless hash.is_a? Hash hash.each_with_object({}) do |pair, acc| key = begin if enable_deprecation_msg && !(pair[0].is_a? Symbol) ::Appium::Logger.warn("[Deprecation] The key '#{pair[0]}' must be a symbol while currently it " \ "is #{pair[0].class.name}. Please define the key as a Symbol. " \ 'Converting it to Symbol for now.') end pair[0].to_sym rescue StandardError => e ::Appium::Logger.warn(e.) pair[0] end value = pair[1] acc[key] = if nested value.is_a?(Hash) ? symbolize_keys(value, nested: false, enable_deprecation_msg: false) : value else value end end end |