Skip to content

Commit e093193

Browse files
authored
Declare block param on Alchemrest::Data.schema for Sorbet (#42)
## Summary `Alchemrest::Data.schema` takes a block at runtime — it `yield`s the transforms DSL — but the method never declared a block parameter. So `tapioca gem alchemrest` generates `def schema; end` (no block), and any app type-checking an `Alchemrest::Data` subclass with Sorbet hits: ``` Method `Alchemrest::Data.schema` does not take a block ``` on every `schema do |s| ... end` definition. This declares an anonymous block parameter (`def self.schema(&)`) so the generated RBI types `schema` as accepting a block. Behavior is unchanged — it still `yield`s. ## Testing - `Alchemrest::Data.method(:schema).parameters` now returns `[[:block, :&]]` - `bundle exec rspec spec/alchemrest/data_spec.rb` → 6 examples, 0 failures - `bundle exec rubocop lib/alchemrest/data.rb` → no offenses Anonymous block params are supported on the gem's required Ruby (`>= 3.2`). Patch bump `3.2.2 → 3.2.3` + CHANGELOG.
1 parent 1a29655 commit e093193

10 files changed

Lines changed: 16 additions & 10 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ and this project aims to adhere to [Semantic Versioning](http://semver.org/spec/
1717

1818
### Fixed <!-- for any bug fixes. -->
1919

20+
## [3.2.3] - 2026-06-18
21+
22+
### Fixed
23+
24+
- `Alchemrest::Data.schema` now declares its block parameter, so Sorbet (and tapioca-generated gem RBIs) type it as accepting a block. Subclasses defining `schema do |s| ... end` no longer fail Sorbet type-checking.
25+
2026
## [3.2.1] - 2026-03-11
2127

2228
### Changed

alchemrest-sentry/Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: ../alchemrest
33
specs:
4-
alchemrest (3.2.2)
4+
alchemrest (3.2.3)
55
activerecord (>= 7.2, < 8.1)
66
activesupport (>= 7.2, < 8.1)
77
circuitbox (~> 2.0.0)

alchemrest-sentry/gemfiles/rails_7_2.gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: ../../alchemrest
33
specs:
4-
alchemrest (3.2.2)
4+
alchemrest (3.2.3)
55
activerecord (>= 7.2, < 8.1)
66
activesupport (>= 7.2, < 8.1)
77
circuitbox (~> 2.0.0)

alchemrest-sentry/gemfiles/rails_8_0.gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: ../../alchemrest
33
specs:
4-
alchemrest (3.2.2)
4+
alchemrest (3.2.3)
55
activerecord (>= 7.2, < 8.1)
66
activesupport (>= 7.2, < 8.1)
77
circuitbox (~> 2.0.0)

alchemrest/Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
alchemrest (3.2.2)
4+
alchemrest (3.2.3)
55
activerecord (>= 7.2, < 8.1)
66
activesupport (>= 7.2, < 8.1)
77
circuitbox (~> 2.0.0)

alchemrest/gemfiles/faraday_2.gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: ..
33
specs:
4-
alchemrest (3.2.2)
4+
alchemrest (3.2.3)
55
activerecord (>= 7.2, < 8.1)
66
activesupport (>= 7.2, < 8.1)
77
circuitbox (~> 2.0.0)

alchemrest/gemfiles/rails_7_2.gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: ..
33
specs:
4-
alchemrest (3.2.2)
4+
alchemrest (3.2.3)
55
activerecord (>= 7.2, < 8.1)
66
activesupport (>= 7.2, < 8.1)
77
circuitbox (~> 2.0.0)

alchemrest/gemfiles/rails_8_0.gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: ..
33
specs:
4-
alchemrest (3.2.2)
4+
alchemrest (3.2.3)
55
activerecord (>= 7.2, < 8.1)
66
activesupport (>= 7.2, < 8.1)
77
circuitbox (~> 2.0.0)

alchemrest/lib/alchemrest/data.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
module Alchemrest
44
class Data
5-
def self.schema
6-
include Alchemrest::Data::Schema.new(**(yield Alchemrest::Transforms))
5+
def self.schema(&)
6+
include Schema.new(**(yield Transforms))
77
end
88
end
99
end
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module Alchemrest
4-
VERSION = "3.2.2"
4+
VERSION = "3.2.3"
55
end

0 commit comments

Comments
 (0)