Skip to content

Commit

Permalink
chroe: inspect browser classes (#428)
Browse files Browse the repository at this point in the history
  • Loading branch information
erickgskovik authored Dec 27, 2023
1 parent 00ed043 commit 681489c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/ferrum/browser/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ def close
@thread.kill unless @thread.join(1)
end

def inspect
"#<#{self.class} " \
"@command_id=#{@command_id.inspect} " \
"@pendings=#{@pendings.inspect} " \
"@ws=#{@ws.inspect}>"
end

private

def build_message(method, params)
Expand Down
4 changes: 4 additions & 0 deletions lib/ferrum/browser/command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ def to_a
[path] + @flags.map { |k, v| v.nil? ? "--#{k}" : "--#{k}=#{v}" }
end

def to_s
to_a.join(" \\ \n ")
end

private

def merge_options
Expand Down
11 changes: 11 additions & 0 deletions lib/ferrum/browser/process.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,17 @@ def restart
start
end

def inspect
"#<#{self.class} " \
"@user_data_dir=#{@user_data_dir.inspect} " \
"@command=#<#{@command.class}:#{@command.object_id}> " \
"@default_user_agent=#{@default_user_agent.inspect} " \
"@ws_url=#{@ws_url.inspect} " \
"@v8_version=#{@v8_version.inspect} " \
"@browser_version=#{@browser_version.inspect} " \
"@webkit_version=#{@webkit_version.inspect}>"
end

private

def kill(pid)
Expand Down

0 comments on commit 681489c

Please sign in to comment.