adds specs for all property types

This commit is contained in:
Jessica Lynn Suttles 2013-02-04 21:05:55 -08:00
parent a02055fd93
commit 9fae5c7248
6 changed files with 60 additions and 40 deletions

View file

@ -8,7 +8,7 @@ module Microformats2
def to_hash
hash = { type: [type], properties: {} }
@added_methods.each do |method_name|
hash[:properties][method_name.to_sym] = send(method_name)
hash[:properties][method_name.to_sym] = send(method_name).to_s
end
hash
end

View file

@ -12,11 +12,13 @@ module Microformats2
class DateTimeProperty
def parse(element)
DateTime.parse(element.attribute("datetime") || property.text)
rescue ArgumentError => e
element.attribute("datetime") || property.text
end
end
class EmbeddedProperty
def parse(element)
element.text
element.text.gsub(/\n+/, " ").gsub(/\s+/, " ").strip
end
end