diff --git a/lib/microformats2/property/embedded.rb b/lib/microformats2/property/embedded.rb index 58de6cc..6efb900 100644 --- a/lib/microformats2/property/embedded.rb +++ b/lib/microformats2/property/embedded.rb @@ -2,7 +2,7 @@ module Microformats2 module Property class Embedded < Foundation def to_s - @to_s ||= @element.inner_html.strip + @to_s ||= string_value || @element.inner_html.strip end end end diff --git a/spec/lib/microformats2/collection_spec.rb b/spec/lib/microformats2/collection_spec.rb index aa75f3e..e5d3be1 100644 --- a/spec/lib/microformats2/collection_spec.rb +++ b/spec/lib/microformats2/collection_spec.rb @@ -83,6 +83,10 @@ describe Microformats2::Collection do @collection.first.add_property("p-foo", value) @collection.first.to_json.should include(value) end + it "supports Embedded" do + @collection.first.add_property("e-foo", value) + @collection.first.foo.to_s.should == value + end it "raises a InvalidPropertyPrefix error if the prefix is invalid" do expect { @collection.first.add_property("xxx-foo", value)