t6d / smart_properties

Ruby accessors on steroids
MIT License
177 stars 20 forks source link

Only convert if there is a converter #20

Closed christhomson closed 9 years ago

christhomson commented 9 years ago

@t6d

This gets around that issue we were running into, where we wanted to avoid calling nil? on the value if not absolutely necessary.

Note that the convert method already just returns if there's no converter: https://github.com/t6d/smart_properties/blob/7f04dd73270e7269f5a0cc3678c482688f45062b/lib/smart_properties.rb#L137.

For now, I just updated the problematic class in our private repo to not use smart_properties because this fix seems pretty fragile. But I figured I'd open a PR here to get your thoughts anyway.