lib/mida/property.rb in mida-0.1.2 vs lib/mida/property.rb in mida-0.1.3
- old
+ new
@@ -9,14 +9,12 @@
# Returns a Hash representing the property.
# Hash is of the form {'property name' => 'value'}
# [element] The itemprop element to be parsed
# [page_url] The url of the page, including the filename, used to form absolute urls
def self.parse(element, page_url=nil)
- hash = {}
- extract_property_names(element).each do |name|
- hash[name] = extract_property(element, page_url)
+ extract_property_names(element).each_with_object({}) do |name, memo|
+ memo[name] = extract_property(element, page_url)
end
- hash
end
NON_TEXTCONTENT_ELEMENTS = {
'a' => 'href', 'area' => 'href',
'audio' => 'src', 'embed' => 'src',