From 88daa295b32dd5ed3d2358c0154909f2a9c78dc9 Mon Sep 17 00:00:00 2001 From: Dmitry Vorotilin Date: Mon, 30 Nov 2026 10:13:07 +0300 Subject: [PATCH] ref(page): hide slowmoable in command's params and tag Worker#main_frame as private API --- lib/ferrum/page.rb | 8 ++------ lib/ferrum/worker.rb | 4 ++++ sig/ferrum/page.rbs | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/ferrum/page.rb b/lib/ferrum/page.rb index 1ae021fa..0d7d3105 100644 --- a/lib/ferrum/page.rb +++ b/lib/ferrum/page.rb @@ -397,10 +397,6 @@ def activate # @param [String] method # The CDP method name, e.g. `"Page.navigate"`. # - # @param [Boolean] slowmoable - # Whether to sleep for `Browser::Options#slowmo` seconds before sending - # the command. - # # @param [Numeric, Deadline, nil] timeout # Overrides the timeout this command's response is bound by. Defaults # to the page's `timeout`. Callers with their own budget (e.g. `#pdf`/ @@ -416,10 +412,10 @@ def activate # @example # page.command("Runtime.evaluate", expression: "1 + 1") # - def command(method, slowmoable: false, timeout: nil, **params) + def command(method, timeout: nil, **params) raise ArgumentError, "wait: is removed, wrap #{method} in await_navigation instead" if params.key?(:wait) - sleep(@options.slowmo) if slowmoable && @options.slowmo.positive? + sleep(@options.slowmo) if params.delete(:slowmoable) && @options.slowmo.positive? client.command(method, timeout: Deadline.wrap(timeout || self.timeout), **params) end diff --git a/lib/ferrum/worker.rb b/lib/ferrum/worker.rb index f8a2eb15..e7ba0e0d 100644 --- a/lib/ferrum/worker.rb +++ b/lib/ferrum/worker.rb @@ -72,6 +72,10 @@ def command(method, timeout: nil, **params) # Workers have a single execution context and no navigable document, so # there's nothing for {Network} to check requests against. + # + # @return [nil] + # + # @api private def main_frame nil end diff --git a/sig/ferrum/page.rbs b/sig/ferrum/page.rbs index 87bc8624..ed069ef3 100644 --- a/sig/ferrum/page.rbs +++ b/sig/ferrum/page.rbs @@ -75,7 +75,7 @@ module Ferrum def window_id: () -> ::Integer - def command: (String method, ?slowmoable: bool, ?timeout: (::Numeric | Deadline)?, **untyped) -> Hash[String, untyped] + def command: (String method, ?timeout: (::Numeric | Deadline)?, **untyped) -> Hash[String, untyped] def on: (:dialog) { (Dialog) -> void } -> Integer | (:console) { (Console::Message) -> void } -> Integer