Module: Feedjira::Podcast::Channel::Apple

Included in:
RSS::Channel
Defined in:
lib/feedjira/podcast/channel/apple.rb

Defined Under Namespace

Modules: InstanceMethods

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/feedjira/podcast/channel/apple.rb', line 70

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.elements :"#{itunes_xml_ns}:category", as: :_itunes_categories, class: AppleCategory

  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}:explicit", as: :_itunes_explicit
  base.element :"#{itunes_xml_ns}:complete", as: :_itunes_complete

  base.element :"#{itunes_xml_ns}:new_feed_url", as: :itunes_new_feed_url do |url|
    Addressable::URI.parse(url.strip)
  end

  base.element :"#{itunes_xml_ns}:owner", as: :_itunes_owner, class: AppleOwner
  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, default: "" do |keywords|
    keywords.split(",").map(&:strip).select { |k| !k.empty? }
  end
end