Skip to content

Commit d8ea744

Browse files
committed
Fixes after rubocop autocorrection
1 parent 4351b0c commit d8ea744

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

lib/grape-swagger.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ def model_parsers
2121

2222
# Copied from https://github.com/ruby-grape/grape/blob/v2.2.0/lib/grape/formatter.rb
2323
FORMATTER_DEFAULTS = {
24+
xml: Grape::Formatter::Xml,
25+
serializable_hash: Grape::Formatter::SerializableHash,
2426
json: Grape::Formatter::Json,
2527
jsonapi: Grape::Formatter::Json,
26-
serializable_hash: Grape::Formatter::SerializableHash,
2728
txt: Grape::Formatter::Txt,
28-
xml: Grape::Formatter::Xml
2929
}.freeze
3030

3131
# Copied from https://github.com/ruby-grape/grape/blob/v2.2.0/lib/grape/content_types.rb

lib/grape-swagger/doc_methods/move_params.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,7 @@ def object_type
163163
end
164164

165165
def prepare_nested_names(property, params)
166-
params.each do |x|
167-
x[:name] = x[:name].to_s.sub(property.to_s, '').sub('[', '').sub(']', '')
168-
end
166+
params.each { |x| x[:name] = x[:name].sub(property.to_s, '').sub('[', '').sub(']', '') }
169167
end
170168

171169
def unify!(params)

lib/grape-swagger/endpoint.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ def content_types_for(target_class)
2222
if content_types.empty?
2323
formats = [target_class.format, target_class.default_format].compact.uniq
2424
formats = GrapeSwagger::FORMATTER_DEFAULTS.keys if formats.empty?
25-
content_types = GrapeSwagger::CONTENT_TYPE_DEFAULTS.select do |content_type, _mime_type| # rubocop:disable Style/HashSlice
26-
formats.include? content_type
27-
end.values
25+
content_types = formats.filter_map { |f| GrapeSwagger::CONTENT_TYPE_DEFAULTS[f] }
2826
end
2927

3028
content_types.uniq

0 commit comments

Comments
 (0)