class Microformat::ItemScope
Attributes
id[R]
type[R]
Public Class Methods
new(node, strict)
click to toggle source
# File lib/microformat.rb, line 60 def initialize(node, strict) @type = attr 'itemtype', node @id = attr 'itemid', node @properties = {} @strict = strict parse_elements node.search './*' end
Public Instance Methods
[](name)
click to toggle source
# File lib/microformat.rb, line 69 def [](name) @properties[name] end
Private Instance Methods
attr(name, node)
click to toggle source
# File lib/microformat.rb, line 74 def attr(name, node) val = node.attribute name val ? val.value : nil end
parse_elements(elements)
click to toggle source
# File lib/microformat.rb, line 79 def parse_elements(elements) elements.each do |el| itemprop = attr('itemprop', el) prop = ItemProp.parse el, @strict if prop @properties[itemprop] ||= [] @properties[itemprop] << prop end parse_elements el.search('./*') end end