diff --git a/lib/blueprinter/rendering.rb b/lib/blueprinter/rendering.rb index 93d769db..e39ef294 100644 --- a/lib/blueprinter/rendering.rb +++ b/lib/blueprinter/rendering.rb @@ -103,14 +103,18 @@ def hashify(object, view_name:, local_options:) def prepare_data(object, view_name, local_options) if array_like?(object) object.map do |obj| - object_to_hash(obj, - view_name: view_name, - local_options: local_options) + object_to_hash( + obj, + view_name: view_name, + local_options: local_options + ) end else - object_to_hash(object, - view_name: view_name, - local_options: local_options) + object_to_hash( + object, + view_name: view_name, + local_options: local_options + ) end end @@ -141,7 +145,7 @@ def apply_root_key(object:, root:) end def add_metadata(object:, metadata:, root:) - return object if metadata.nil? + return object unless metadata return object.merge(meta: metadata) if root raise(Errors::MetaRequiresRoot)