Skip to content

Commit

Permalink
Explicitly add ostruct gem in case of Ruby 3.5
Browse files Browse the repository at this point in the history
  • Loading branch information
numbata committed Feb 18, 2025
1 parent f7d81cb commit ec6a477
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ group :development, :test do
unless ENV['MODEL_PARSER'] == 'grape-swagger-entity'
gem 'grape-swagger-entity', git: 'https://github.com/ruby-grape/grape-swagger-entity'
end

# Conditionally load 'ostruct' only if Ruby >= 3.5.0
gem 'ostruct' if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.5.0')
end

group :test do
Expand Down
2 changes: 1 addition & 1 deletion lib/grape-swagger/endpoint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def content_types_for(target_class)
if content_types.empty?
formats = [target_class.format, target_class.default_format].compact.uniq
formats = GrapeSwagger::FORMATTER_DEFAULTS.keys if formats.empty?
content_types = GrapeSwagger::CONTENT_TYPE_DEFAULTS.select do |content_type, _mime_type|
content_types = GrapeSwagger::CONTENT_TYPE_DEFAULTS.select do |content_type, _mime_type| # rubocop:disable Style/HashSlice
formats.include? content_type
end.values
end
Expand Down

0 comments on commit ec6a477

Please sign in to comment.