adds Property::Foundation#format

This commit is contained in:
Jessica Lynn Suttles 2013-02-18 12:07:16 -08:00
parent b3ed1207c6
commit bffa750923
2 changed files with 8 additions and 1 deletions

View file

@ -18,6 +18,10 @@ module Microformats2
@to_s ||= value_class_pattern || element_value || text_value
end
def format
formats.first
end
def formats
@formats ||= format_classes.length >=1 ? FormatParser.parse(@element) : []
end

View file

@ -149,9 +149,12 @@ describe Microformats2::Collection do
it "HCard#author is a Property::Text" do
@collection.entry.author.should be_kind_of Microformats2::Property::Text
end
it "assigns HCard to Property::Text#formats" do
it "assigns all HCard to Property::Text#formats" do
@collection.entry.author.formats.first.should be_kind_of HCard
end
it "assigns the first HCard to Property::Text#format" do
@collection.entry.author.format.should be_kind_of HCard
end
end
end
end