Skip to content

Commit

Permalink
[Lint] Sorry but I want to use OpenStruct here
Browse files Browse the repository at this point in the history
Probably there's some better way, but I'd like to prioritize
quick release.
  • Loading branch information
okuramasafumi committed Oct 13, 2023
1 parent ed82392 commit aa41c8c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/alba/conditional_attribute.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ def with_two_arity_proc_condition

# OpenStruct is used as a simple solution for converting Hash or Array of Hash into an object
# Using OpenStruct is not good in general, but in this case there's no other solution
# rubocop:disable Style/OpenStructUse
# rubocop:disable Performance/OpenStruct
def objectize(fetched_attribute)
return fetched_attribute unless @body.is_a?(Alba::Association)

Expand All @@ -62,5 +64,7 @@ def objectize(fetched_attribute)
OpenStruct.new(fetched_attribute)
end
end
# rubocop:enable Style/OpenStructUse
# rubocop:enable Performance/OpenStruct
end
end

0 comments on commit aa41c8c

Please sign in to comment.