lib/feedjira/podcast/item/optional.rb in feedjira-podcast-0.9.1 vs lib/feedjira/podcast/item/optional.rb in feedjira-podcast-0.9.2
- old
+ new
@@ -22,17 +22,20 @@
base.element :enclosure, as: :enclosure_url, value: :url do |url|
Addressable::URI.parse(url)
end
- base.element :enclosure, as: :enclosure_length, value: :length
+ base.element :enclosure, as: :enclosure_length, value: :length do |length|
+ length.to_f
+ end
+
base.element :enclosure, as: :enclosure_type, value: :type
def enclosure
@enclosure ||= Struct.new(:url, :length, :type).new(
enclosure_url,
- (enclosure_length && enclosure_length.to_f),
+ enclosure_length,
enclosure_type,
)
end
base.element :guid, as: :guid, class: GUID, default: Struct.new(:guid, :perma_link?).new
@@ -43,12 +46,10 @@
rescue
nil
end
end
- base.element :source do |source|
- Addressable::URI.parse(source)
- end
+ base.element :source, class: Source, default: Struct.new(:name, :url?).new
end
end
end
end