Class: Microformat::Simple
- Extended by:
- Base
- Defined in:
- lib/microformat/simple.rb
Direct Known Subclasses
Class Method Summary collapse
- .build_class(tag) ⇒ Object
- .find_first(doc) ⇒ Object
- .find_occurences(doc) ⇒ Object
- .from(options) ⇒ Object
- .from_as_xpath ⇒ Object
Methods included from Base
Methods inherited from String
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(doc) end |
.from(options) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/microformat/simple.rb', line 19 def self.from() @from ||= [] .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 |