class Rubyfocus::RankedItem
Attributes
rank[RW]
Public Instance Methods
ancestry()
click to toggle source
Retrieve a full list of the parents of this item. [0] = immediate parent
# File lib/rubyfocus/items/ranked_item.rb, line 9 def ancestry if container [container] + container.ancestry else [] end end
apply_xml(n)
click to toggle source
Calls superclass method
Rubyfocus::NamedItem#apply_xml
# File lib/rubyfocus/items/ranked_item.rb, line 27 def apply_xml(n) super(n) conditional_set(:rank, n.at_xpath("xmlns:rank")){ |e| e.inner_html.to_i } end
contained_within?(object)
click to toggle source
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.
# File lib/rubyfocus/items/ranked_item.rb, line 19 def contained_within?(object) if [String, Integer, Hash, Proc].include?(object.class) document.find_all(object).any?{ |o| ancestry.include?(o) } else ancestry.include?(object) end end
Private Instance Methods
inspect_properties()
click to toggle source
Calls superclass method
Rubyfocus::NamedItem#inspect_properties
# File lib/rubyfocus/items/ranked_item.rb, line 33 def inspect_properties super + %w(rank) end