ahlatimer/lazy_resource — pull request #6 by andyhite (2013-08-20 17:16:21+00:00)
Title: Proc-based inline routes

This pull request adds the ability to do the following:

```ruby
class FooBar
include LazyResource::Resource

attribute :baz, Baz, route: lambda { "/foobar/#{id}/baz" }
end
```

I had to get a little crafty to pass the proc into the spot where it needs to be eval'd, so if the route option is a proc then it defines a method on the resource's instance named "#{attribute_name}_route" that returns the proc and redefines the route option to the name of the new method. If the instance responds to the method name (as usual) and the method returns the proc, it calls it.

That bit in the spec that checks the attributes that are available on the object seems a bit odd to me, since it uses the values that were defined in other unrelated tests before it. I don't like that whole constant thing I had to throw in there, but it was the quickest way to get that to pass without too much re-working of the spec. If you have a better idea, let me know and I'll update the pull request.