Module: Microformats2::Property
- Defined in:
- lib/microformats2/property.rb,
lib/microformats2/property/url.rb,
lib/microformats2/property/text.rb,
lib/microformats2/property/embedded.rb,
lib/microformats2/property/date_time.rb,
lib/microformats2/property/foundation.rb
Defined Under Namespace
Classes: DateTime, Embedded, Foundation, Text, Url
Constant Summary collapse
- CLASS_REG_EXP =
/^(p-|u-|dt-|e-)/- PREFIX_CLASS_MAP =
{ "p" => Text, "u" => Url, "dt" => DateTime, "e" => Embedded }
Class Method Summary collapse
Class Method Details
.new(element, property_class, value = nil, base = nil) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/microformats2/property.rb', line 11 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 |