intridea/grape-entity — pull request #90 by wyattisimo (2014-09-05 22:42:51+00:00)
Title: implement universally unique attributes to silo exposure logic

Here's my first stab at issue #52. It silos exposure logic by creating a universally unique attribute for each exposure.

It allows for stuff like this to work properly:

```ruby
expose :name, if: { greeting: :formal } do |obj, opts|
"#{obj.title} #{obj.first_name} #{obj.last_name}"
end

expose :name, if: { greeting: :friendly } do |obj, opts|
"#{obj.nick_name}"
end
```

This ended up requiring more tweaking than I expected. I also had to modify a number of specs that are accessing certain protected methods that now require a unique attribute (like `value_for`).

I added [specs to test applying "if" conditions to an attribute in separate exposure declarations](https://github.com/wyattisimo/grape-entity/blob/master/spec/grape_entity/entity_spec.rb#L23-L59), and all existing specs are currently passing, but there are likely some new use cases and/or side effects that need to be discussed/resolved.