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/device/value.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/ios/uiautomation/patch.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/ios/uiautomation/bridge.rb,
lib/appium_lib_core/ios/uiautomation/device.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/common/base/search_context.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/common/device/touch_actions.rb,
lib/appium_lib_core/ios/xcuitest/device/battery.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/common/touch_action/multi_touch.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/touch_action/touch_actions.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

Class Method Summary collapse

Class Method Details

.symbolize_keys(hash) ⇒ Object

convert all keys (including nested) to symbols

based on deep_symbolize_keys & deep_transform_keys from rails github.com/rails/docrails/blob/a3b1105ada3da64acfa3843b164b14b734456a50/activesupport/lib/active_support/core_ext/hash/keys.rb#L84

Parameters:

  • hash (Hash)

    Hash value to make symbolise

Raises:



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/appium_lib_core.rb', line 29

def self.symbolize_keys(hash)
  raise ::Appium::Core::Error::ArgumentError, 'symbolize_keys requires a hash' unless hash.is_a? Hash

  hash.each_with_object({}) do |pair, acc|
    key = begin
      pair[0].to_sym
    rescue StandardError => e
      ::Appium::Logger.warn(e.message)
      pair[0]
    end

    value = pair[1]
    acc[key] = value.is_a?(Hash) ? symbolize_keys(value) : value
  end
end