Skip to content

Commit

Permalink
Rubocop formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
singhprd committed Jan 4, 2025
1 parent b421183 commit 6206429
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 18 deletions.
2 changes: 1 addition & 1 deletion lib/ferrum/page.rb
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ def subscribe
end
end

on(:screencastFrame) do |params, index, total|
on(:screencastFrame) do |params, _index, _total|
@screencaster.add_frame(params)
warn "DEBUG: frame added in page.rb"
end
Expand Down
3 changes: 2 additions & 1 deletion lib/ferrum/page/screencast.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# frozen_string_literal: true

require "ferrum/screencaster"

module Ferrum
class Page
module Screencast
attr_reader :screencaster

def start_screencast #(options)
def start_screencast
@screencaster.start_screencast
end

Expand Down
32 changes: 16 additions & 16 deletions lib/ferrum/screencaster.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@

module Ferrum
class Screencaster
def initialize(page)
@page = page
end
def initialize(page)
@page = page
end

def add_frame(params)
warn 'frame'
@page.command("Page.screencastFrameAck", sessionId: params["sessionId"])
def add_frame(params)
warn "frame"
@page.command("Page.screencastFrameAck", sessionId: params["sessionId"])

ts = (Time.now.to_f * 1000).to_i
File.binwrite("img_#{ts}.jpeg", Base64.decode64(params["data"]))
end
ts = (Time.now.to_f * 1000).to_i
File.binwrite("img_#{ts}.jpeg", Base64.decode64(params["data"]))
end

def start_screencast
@page.command("Page.startScreencast", format: "jpeg")
end
def start_screencast
@page.command("Page.startScreencast", format: "jpeg")
end

def stop_screencast
warn 'stopped'
@page.command("Page.stopScreencast")
end
def stop_screencast
warn "stopped"
@page.command("Page.stopScreencast")
end
end
end

0 comments on commit 6206429

Please sign in to comment.