Module: Feedjira::Podcast::Item::Apple
- Included in:
- Channel::Item
- Defined in:
- lib/feedjira/podcast/item/apple.rb
Defined Under Namespace
Modules: InstanceMethods
Class Method Summary collapse
Class Method Details
.included(base) ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/feedjira/podcast/item/apple.rb', line 57 def self.included(base) base.include(InstanceMethods) itunes_xml_ns = "itunes" base.element :"#{itunes_xml_ns}:author", as: :itunes_author base.element :"#{itunes_xml_ns}:block", as: :_itunes_block base.element :"#{itunes_xml_ns}:image", as: :itunes_image_href, value: :href do |href| Addressable::URI.parse(href.strip) end base.element :"#{itunes_xml_ns}:duration", as: :itunes_duration do |d| ["0:0:0:#{d}".split(":")[-3, 3].map(&:to_i)].inject(0) do |_m, i| (i[0] * 3600) + (i[1] * 60) + i[2] end end base.element :"#{itunes_xml_ns}:explicit", as: :_itunes_explicit base.element :"#{itunes_xml_ns}:isClosedCaptioned", as: :_itunes_is_closed_captioned base.element :"#{itunes_xml_ns}:order", as: :itunes_order, &:to_f base.element :"#{itunes_xml_ns}:subtitle", as: :itunes_subtitle base.element :"#{itunes_xml_ns}:summary", as: :itunes_summary # Legacy support base.element :"#{itunes_xml_ns}:keywords", as: :itunes_keywords do |keywords| keywords.split(",").map(&:strip).select { |k| !k.empty? } end end |