adds specs for all property types
This commit is contained in:
parent
a02055fd93
commit
9fae5c7248
6 changed files with 60 additions and 40 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue