Sha256: 7f00e7f468781861a720858d15810b2d811db30a66171b2039c3b4b813d0da0d

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
    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.10 ./lib/microformat/simple.rb
mofo-0.2.11 ./lib/microformat/simple.rb
mofo-0.2.12 ./lib/microformat/simple.rb
mofo-0.2.13 ./lib/microformat/simple.rb
mofo-0.2.14 ./lib/microformat/simple.rb
mofo-0.2.15 ./lib/microformat/simple.rb
mofo-0.2.16 ./lib/microformat/simple.rb
mofo-0.2.9 ./lib/microformat/simple.rb