refine some finders

This commit is contained in:
John Bintz 2013-01-25 08:43:49 -05:00
parent c9efe01af7
commit c4387c9f43
1 changed files with 8 additions and 2 deletions

View File

@ -106,11 +106,17 @@ def within_object(object, &block)
end
def object_matcher(object)
"[data-id='#{object.id}'][data-type='#{object.class}']"
if object.respond_to?(:id)
match = "[data-type='#{object.class}'][data-id='#{object.id}']"
elsif object.kind_of?(::Class)
match = "[data-type='#{object}']"
end
match
end
def within_object_of_type(klass, &block)
within("[data-type='#{klass}']", &block)
within_object(klass, &block)
end
def within_any(search, &block)