lib/rubyfocus/items/ranked_item.rb in rubyfocus-0.5.4 vs lib/rubyfocus/items/ranked_item.rb in rubyfocus-0.5.5
- old
+ new
@@ -14,11 +14,14 @@
end
# Is this item contained within another? You may supply an object, string or integer ID, hash of properties,
# or proc to run on each item.
def contained_within?(object)
- object = document.find(object) if [String, Fixnum, Hash, Proc].include?(object.class)
- ancestry.include?(object)
+ if [String, Fixnum, Hash, Proc].include?(object.class)
+ document.find_all(object).any?{ |o| ancestry.include?(o) }
+ else
+ ancestry.include?(object)
+ end
end
def apply_xml(n)
super(n)
conditional_set(:rank, n.at_xpath("xmlns:rank")){ |e| e.inner_html.to_i }
\ No newline at end of file