Skip to content

Commit ee316f4

Browse files
committed
Remove to_sym calls duplication
1 parent 1214218 commit ee316f4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/grape_entity/entity.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -161,13 +161,13 @@ def self.expose(*args, &block)
161161
args.each do |attribute|
162162
unless @nested_attributes.empty?
163163
orig_attribute = attribute.to_sym
164-
attribute = "#{@nested_attributes.last}__#{attribute}"
165-
nested_attribute_names[attribute.to_sym] = orig_attribute
164+
attribute = "#{@nested_attributes.last}__#{attribute}".to_sym
165+
nested_attribute_names[attribute] = orig_attribute
166166
options[:nested] = true
167-
nested_exposures.deep_merge!(@nested_attributes.last.to_sym => { attribute.to_sym => options })
167+
nested_exposures.deep_merge!(@nested_attributes.last.to_sym => { attribute => options })
168168
end
169169

170-
exposures[attribute.to_sym] = options
170+
exposures[attribute] = options
171171

172172
# Nested exposures are given in a block with no parameters.
173173
if block_given? && block.parameters.empty?

0 commit comments

Comments
 (0)