Skip to content

Commit 8c704ee

Browse files
Support OpenStruct in Awesome Print
Fix #62
1 parent 898fe27 commit 8c704ee

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

lib/appium_lib/driver.rb

+16-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,22 @@
55
https://github.com/appium/appium/blob/c58eeb66f2d6fa3b9a89d188a2e657cca7cb300f/LICENSE
66
=end
77

8+
require 'rubygems'
9+
require 'ap'
10+
11+
# Support OpenStruct in Awesome Print
12+
# /awesome_print/lib/awesome_print/formatter.rb
13+
# upstream issue: https://github.com/michaeldv/awesome_print/pull/36
14+
class AwesomePrint::Formatter
15+
remove_const :CORE if defined?(CORE)
16+
CORE = [ :array, :hash, :class, :file, :dir, :bigdecimal, :rational, :struct, :openstruct, :method, :unboundmethod ]
17+
18+
def awesome_openstruct target
19+
awesome_hash target.marshal_dump
20+
end
21+
end
22+
23+
824
# Load appium.txt (toml format) into system ENV
925
# the basedir of this file + appium.txt is what's used
1026
# @param opts [Hash] file: '/path/to/appium.txt', verbose: true
@@ -34,7 +50,6 @@ def update data, *args
3450

3551
if toml_exists
3652
require 'toml'
37-
require 'ap'
3853
puts "Loading #{toml}" if verbose
3954

4055
# bash requires A="OK"

0 commit comments

Comments
 (0)