Class: Microformat::Simple
Class Method Summary
collapse
Methods included from Base
find, find_in_children, timeout=
Methods inherited from String
#coerce, #strip_html
Class Method Details
.build_class(tag) ⇒ Object
15
16
17
|
# File 'lib/microformat/simple.rb', line 15
def self.build_class(tag)
new(tag.innerText || '')
end
|
.find_first(doc) ⇒ Object
7
8
9
|
# File 'lib/microformat/simple.rb', line 7
def self.find_first(doc)
find_every(doc).first
end
|
.find_occurences(doc) ⇒ Object
11
12
13
|
# File 'lib/microformat/simple.rb', line 11
def self.find_occurences(doc)
@from ? doc/from_as_xpath : super
end
|
.from(options) ⇒ Object
19
20
21
22
23
24
|
# File 'lib/microformat/simple.rb', line 19
def self.from(options)
@from ||= []
options.each do |tag, value|
@from << "@#{tag}=#{value}"
end
end
|
.from_as_xpath ⇒ Object
26
27
28
|
# File 'lib/microformat/simple.rb', line 26
def self.from_as_xpath
"[#{@from.to_a * "|"}]"
end
|