Fix Context#find for Hash-like objects #106

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
3 participants
Contributor

koraktor commented Aug 17, 2011

This removes the exclusion of Hash-like objects from method execution through Context#find.

I encountered this problem while trying to get the size of a object inheriting from Hash.

I usually would not check for Hash at all but this would clash with use cases like test_id_with_nested_context where you wouldn't be able to access the :id key because of Object#id.
A possible solution for that problem would be a special Hash subclass for the Mustache contexts. Any thoughts on that?

Fix Context#find for Hash-like objects
This removes the exclusion of Hash-like objects from method execution
through Context#find. That way, you're able to call e.g. `size` on an
object inheriting from Hash.

trans commented on 2705d9a Nov 22, 2011

get rid of obj.has_key?(key) and move that condition down one.

Owner

locks commented Feb 18, 2014

This is quite a long shot, but would you mind adding some tests before I merge this in?

Owner

locks commented Feb 18, 2014

Actually, I'm closing this one since I merged in #121

@locks locks closed this Feb 18, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment