lib/alba/conditional_attribute.rb in alba-3.1.0 vs lib/alba/conditional_attribute.rb in alba-3.2.0
- old
+ new
@@ -49,12 +49,10 @@
@condition.is_a?(Proc) && @condition.arity >= 2
end
# 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)
if fetched_attribute.is_a?(Array)
fetched_attribute.map do |hash|
@@ -62,9 +60,7 @@
end
else
OpenStruct.new(fetched_attribute)
end
end
- # rubocop:enable Style/OpenStructUse
- # rubocop:enable Performance/OpenStruct
end
end