Skip to content

Commit 30e188f

Browse files
committed
Just keep helpers method in the public scope.
1 parent 49e8e63 commit 30e188f

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
#### Fixes
1616

17+
* [#2586](https://github.com/ruby-grape/grape/pull/2586): Limit helpers DSL public scope - [@ericproulx](https://github.com/ericproulx).
1718
* Your contribution here.
1819

1920
### 2.4.0 (2025-06-18)

lib/grape/dsl/helpers.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def helpers(*new_modules, &block)
3434
include_all_in_scope if !block && new_modules.empty?
3535
end
3636

37-
protected
37+
private
3838

3939
def include_new_modules(modules)
4040
return if modules.empty?

spec/grape/dsl/helpers_spec.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,5 +113,11 @@ def test
113113
expect { api_class }.not_to raise_exception
114114
end
115115
end
116+
117+
context 'public scope' do
118+
it 'returns helpers only' do
119+
expect(Class.new { extend Grape::DSL::Helpers }.singleton_methods).to contain_exactly(:helpers)
120+
end
121+
end
116122
end
117123
end

0 commit comments

Comments
 (0)