Skip to content

Commit ec6a477

Browse files
committed
Explicitly add ostruct gem in case of Ruby 3.5
1 parent f7d81cb commit ec6a477

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

Gemfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ group :development, :test do
3737
unless ENV['MODEL_PARSER'] == 'grape-swagger-entity'
3838
gem 'grape-swagger-entity', git: 'https://github.com/ruby-grape/grape-swagger-entity'
3939
end
40+
41+
# Conditionally load 'ostruct' only if Ruby >= 3.5.0
42+
gem 'ostruct' if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.5.0')
4043
end
4144

4245
group :test do

lib/grape-swagger/endpoint.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def content_types_for(target_class)
1212
if content_types.empty?
1313
formats = [target_class.format, target_class.default_format].compact.uniq
1414
formats = GrapeSwagger::FORMATTER_DEFAULTS.keys if formats.empty?
15-
content_types = GrapeSwagger::CONTENT_TYPE_DEFAULTS.select do |content_type, _mime_type|
15+
content_types = GrapeSwagger::CONTENT_TYPE_DEFAULTS.select do |content_type, _mime_type| # rubocop:disable Style/HashSlice
1616
formats.include? content_type
1717
end.values
1818
end

0 commit comments

Comments
 (0)