Skip to content

Commit cd1b727

Browse files
author
James McCarthy
committed
Fix the Ruboop errors.
1 parent 5d167cd commit cd1b727

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

lib/grape_entity/exposure/base.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def nesting?
4242
end
4343

4444
# if we have any nesting exposures with the same name.
45-
def deep_complex_nesting?(entity)
45+
def deep_complex_nesting?(entity) # rubocop:disable Lint/UnusedMethodArgument
4646
false
4747
end
4848

@@ -103,7 +103,7 @@ def attr_path(entity, options)
103103
end
104104
end
105105

106-
def key(entity=nil)
106+
def key(entity = nil)
107107
@key.respond_to?(:call) ? @key.call(entity).try(:to_sym) : @key
108108
end
109109

lib/grape_entity/exposure/nesting_exposure.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,9 @@ def normalized_exposures(entity, options)
111111
end
112112
new_nested_exposures = nesting_tail.flat_map(&:nested_exposures)
113113
NestingExposure.new(key, {}, [], new_nested_exposures).tap do |new_exposure|
114-
new_exposure.instance_variable_set(:@deep_complex_nesting, true) if nesting_tail.any? { |exposure| exposure.deep_complex_nesting?(entity) }
114+
if nesting_tail.any? { |exposure| exposure.deep_complex_nesting?(entity) }
115+
new_exposure.instance_variable_set(:@deep_complex_nesting, true)
116+
end
115117
end
116118
else
117119
last_exposure

lib/grape_entity/exposure/nesting_exposure/nested_exposures.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
module Grape
24
class Entity
35
module Exposure
@@ -56,8 +58,8 @@ def deep_complex_nesting?(entity)
5658
all_nesting = select(&:nesting?)
5759
@deep_complex_nesting =
5860
all_nesting
59-
.group_by { |exposure| exposure.key(entity) }
60-
.any? { |_key, exposures| exposures.length > 1 }
61+
.group_by { |exposure| exposure.key(entity) }
62+
.any? { |_key, exposures| exposures.length > 1 }
6163
else
6264
@deep_complex_nesting
6365
end

0 commit comments

Comments
 (0)