Skip to content

Commit 0c4d14b

Browse files
authored
Add RBS types (#565)
1 parent e1b51b1 commit 0c4d14b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+2241
-22
lines changed

.github/workflows/linter.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
strategy:
1212
fail-fast: false
1313
matrix:
14-
ruby: [ "2.7", "3.0" ]
14+
ruby: ["3.1", "4.0"]
1515
runs-on: ubuntu-latest
1616
steps:
1717
- name: Checkout code

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
strategy:
1212
fail-fast: false
1313
matrix:
14-
ruby: ["2.7", "3.0", "3.1", "3.2", "3.3", "3.4"]
14+
ruby: ["3.1", "3.2", "3.3", "3.4", "4.0"]
1515
runs-on: ubuntu-latest
1616
env:
1717
FERRUM_PROCESS_TIMEOUT: 25

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ tmp
77
.ruby-version
88
.yardoc
99
.tool-versions
10+
.gem_rbs_collection

.rubocop.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
AllCops:
2-
TargetRubyVersion: 2.7
2+
TargetRubyVersion: 3.1
33
NewCops: enable
44
SuggestExtensions: false
55

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
### Added
44
- `Ferrum::Network::Response#body!` returns body or throws error if implicable
55
- `Ferrum::Browser#new(dockerize: true)` whether to add CLI flags to run a browser in a container, `false` by default
6+
- Initial support for RBS types [#565]
67

78
### Changed
89
- `Ferrum::Network::Response#body` returns body or nil in case of errors
910
- Disable Chrome code sign clones [#555]
1011
- `Ferrum::Browser` option `:pending_connection_errors` is set to false by default
12+
- Ruby version required is >= 3.1 [#565]
1113

1214
### Fixed
1315
- Proper handle wss urls, and fix session_id loss for undetermined order of CDP events [#559]

Gemfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22

33
source "https://rubygems.org"
44

5-
gem "byebug", "~> 11.0", platforms: %i[mri mingw x64_mingw]
5+
gem "byebug", "~> 11.0", platforms: %i[mri windows]
66
gem "chunky_png", "~> 1.3"
77
gem "image_size", "~> 2.0"
88
gem "kramdown", "~> 2.0", require: false
9+
gem "ostruct"
910
gem "pdf-reader", "~> 2.12"
1011
gem "puma", ">= 5.6.7"
1112
gem "rake", "~> 13.0"
13+
gem "rbs", "~> 3.10"
1214
gem "redcarpet", require: false, platform: :mri
1315
gem "rspec", "~> 3.8"
1416
gem "rspec-wait"

ferrum.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
2323
"rubygems_mfa_required" => "true"
2424
}
2525

26-
s.required_ruby_version = ">= 2.7.0"
26+
s.required_ruby_version = ">= 3.1"
2727

2828
s.add_dependency "addressable", "~> 2.5"
2929
s.add_dependency "base64", "~> 0.2"

lib/ferrum/browser/options/base.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ def to_h
2626
end
2727

2828
def except(*keys)
29-
to_h.reject { |n, _| keys.include?(n) }
29+
to_h.except(*keys)
3030
end
3131

3232
def detect_path
33-
Binary.find(self.class::PLATFORM_PATH[Utils::Platform.name])
33+
Binary.find(self.class::PLATFORM_PATH[Utils::Platform.platform_name])
3434
end
3535

3636
def merge_required(flags, options, user_data_dir)

lib/ferrum/client.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ def command(method, async: false, **params)
2424
@client.send_message(message, async: async)
2525
end
2626

27-
def on(event, &block)
28-
@client.on(event_name(event), &block)
27+
def on(event, &)
28+
@client.on(event_name(event), &)
2929
end
3030

3131
def off(event, id)
@@ -40,8 +40,8 @@ def respond_to_missing?(name, include_private)
4040
@client.respond_to?(name, include_private)
4141
end
4242

43-
def method_missing(name, *args, **opts, &block)
44-
@client.send(name, *args, **opts, &block)
43+
def method_missing(name, ...)
44+
@client.send(name, ...)
4545
end
4646

4747
def close
@@ -102,8 +102,8 @@ def send_message(message, async:)
102102
end
103103
end
104104

105-
def on(event, &block)
106-
@subscriber.on(event, &block)
105+
def on(event, &)
106+
@subscriber.on(event, &)
107107
end
108108

109109
def off(event, id)

lib/ferrum/contexts.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ def default_context
2222
@default_context ||= create
2323
end
2424

25-
def each(&block)
25+
def each(&)
2626
return enum_for(__method__) unless block_given?
2727

28-
@contexts.each(&block)
28+
@contexts.each(&)
2929
end
3030

3131
def [](id)

0 commit comments

Comments
 (0)