Sha256: 8a549fd77f34a4a020011b7b3fcd27a1dfef6334b506ba85d5120f1bb50a4590

Contents?: true

Size: 525 Bytes

Versions: 8

Compression:

Stored size: 525 Bytes

Contents

require 'microformat'

class Microformat
  class Simple < String
    extend Microformat::Base

    def self.find_first(doc)
      find_every(doc).first
    end

    def self.find_occurences(doc)
      @from ? doc/from_as_xpath : super(doc)
    end

    def self.build_class(tag)
      new(tag.innerText) 
    end

    def self.from(options)
      @from ||= []
      options.each do |tag, value|
        @from << "@#{tag}=#{value}"
      end
    end

    def self.from_as_xpath
      "[#{@from.to_a * "|"}]"
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
mofo-0.2.6 ./lib/microformat/simple.rb
mofo-0.2.1 lib/microformat/simple.rb
mofo-0.2.2 lib/microformat/simple.rb
mofo-0.2.3 ./lib/microformat/simple.rb
mofo-0.2.4 ./lib/microformat/simple.rb
mofo-0.2.5 ./lib/microformat/simple.rb
mofo-0.2.8 ./lib/microformat/simple.rb
mofo-0.2 lib/microformat/simple.rb