Skip to content

Commit

Permalink
Use improved syntax for handling wrapping as array
Browse files Browse the repository at this point in the history
  • Loading branch information
richardhallett committed May 27, 2019
1 parent ae083e9 commit b7edffa
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions app/serializers/doi_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,8 @@ class DoiSerializer
end

attribute :creators do |object|
# If we're just a hash then force this over to a list.
if object.creators.class == Hash
object.creators = [object.creators]
end

object.creators
# Always return an array of creators
Array.wrap(object.creators)
end

attribute :state do |object|
Expand Down

0 comments on commit b7edffa

Please sign in to comment.