Skip to content

Commit

Permalink
ref: Preparation for a flatten mode
Browse files Browse the repository at this point in the history
  • Loading branch information
route committed Jan 6, 2024
1 parent af88f87 commit fe3fb6b
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/ferrum/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ def initialize(ws_url, options)

def command(method, async: false, **params)
message = build_message(method, params)
send_message(message, async: async)
end

def send_message(message, async:)
if async
@ws.send_message(message)
true
Expand Down Expand Up @@ -66,6 +69,10 @@ def inspect
"@ws=#{@ws.inspect}>"
end

def build_message(method, params)
{ method: method, params: params }.merge(id: next_command_id)
end

private

def start
Expand All @@ -83,10 +90,6 @@ def start
end
end

def build_message(method, params)
{ method: method, params: params }.merge(id: next_command_id)
end

def next_command_id
@command_id += 1
end
Expand Down

0 comments on commit fe3fb6b

Please sign in to comment.