Skip to content

Commit

Permalink
[builder] Only merge into a nameless node if result is a hash
Browse files Browse the repository at this point in the history
  • Loading branch information
nesquena committed Feb 26, 2012
1 parent 3730213 commit 0e2c611
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/rabl/builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ def node(name, options={}, &block)
result = block.call(@_object)
if name.present?
@_result[name] = result
else
@_result.merge!(result) if result
else # merge into root hash
@_result.merge!(result) if result.respond_to?(:each_pair)
end
end
alias_method :code, :node
Expand Down

0 comments on commit 0e2c611

Please sign in to comment.