Sha256: 573f1d0cd3fb845e16713d3fa3e4533bb32f4896d09c1d836507d1d554052457

Contents?: true

Size: 555 Bytes

Versions: 6

Compression:

Stored size: 555 Bytes

Contents

module Microformats2
  module Property
    CLASS_REG_EXP = /^(p-|u-|dt-|e-)/
    PREFIX_CLASS_MAP = {
      "p" => Text,
      "u" => Url,
      "dt" => DateTime,
      "e" => Embedded }

    class << self
	    def new(element, property_class, value=nil, base=nil)
	      # p-class-name -> p
	      prefix = property_class.split("-").first
	      # find ruby class for kind of property
	      klass = PREFIX_CLASS_MAP[prefix]
	      raise InvalidPropertyPrefix unless klass
	      klass.new(element, property_class, value, base)
	    end
	  end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
microformats2-2.9.0 lib/microformats2/property.rb
microformats2-2.1.0 lib/microformats2/property.rb
microformats2-2.0.3 lib/microformats2/property.rb
microformats2-2.0.2 lib/microformats2/property.rb
microformats2-2.0.1 lib/microformats2/property.rb
microformats2-2.0.0 lib/microformats2/property.rb