rails/jbuilder — pull request #23 by bigjason (2012-02-15 23:23:22+00:00)
Title: Allow nesting of Jbuilder objects

Small change that detects when another jbuilder object is being added. This allows chaining objects together in a manner similar to partials. Very useful when using jbuilder outside of rails templates.

A contrived example:

```ruby
class Person
def to_builder
person = Jbuilder.new
person.(self, :name, :age)
end
end

class Company
def to_builder
company = Jbuilder.new
company.name name
company.president president.to_builder
end
end

puts company.to_builder.target!
```