apotonick/representable — pull request #76 by pivotal-casebook (2014-03-14 13:58:15+00:00)
Title: Add option to ignore property if instance is nil.

This is helpful when the property is a nested one and the associated representer expects a real instance, not a fragment.

We have a scenario where we use the 'instance' option with a Proc that might return nil based on the original data being deserialized. In this case, we would like Representable to ignore the property, and not pass down the fragment to the associated representer.

```
property :foo, extend: FooRepresenter, instance: lambda { |*| nil }, ignore_nil_instance: true
```
With that property, we don't want FooRepresenter to call its setters with a fragment (we use XML and receive a Nokogiri::Node). The instance Proc already reviewed the fragment and decided that nothing had to be done.

We are happy to hear thoughts or suggestions.

Cheers!