Sha256: 3bf81f0ef5c4c4086bee59c857f978fb7d1e36a13b2c821a50244b174b7ac819

Contents?: true

Size: 1.34 KB

Versions: 9

Compression:

Stored size: 1.34 KB

Contents

module Feedjira
  module Podcast
    module Channel
      module Atom
        def self.included(base)

          ['self', 'hub'].each do |rel|
            [:"atom:link", :"atom10:link"].each do |ns|
              base.element ns, with: { rel: rel }, as: "atom_#{rel}_link_href".to_sym, value: :href do |href|
                Addressable::URI.parse(href)
              end
              base.element ns, with: { rel: rel }, as: "atom_#{rel}_link_rel".to_sym, value: :rel
              base.element ns, with: { rel: rel }, as: "atom_#{rel}_link_type".to_sym, value: :type
            end
          end

          def atom
            @atom ||= Struct.new(:link).new(atom_link)
          end

          private

          def atom_link
            @atom_link ||= Struct.new(:self, :hub).new(
              atom_link_self,
              atom_link_hub,
            )
          end

          def atom_link_self
            @atom_link_self ||= Struct.new(:href, :rel, :type).new(
              atom_self_link_href,
              atom_self_link_rel,
              atom_self_link_type,
            )
          end

          def atom_link_hub
            @atom_link_hub ||= Struct.new(:href, :rel, :type).new(
              atom_hub_link_href,
              atom_hub_link_rel,
              atom_hub_link_type,
            )
          end

        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
feedjira-podcast-0.9.8 lib/feedjira/podcast/channel/atom.rb
feedjira-podcast-0.9.7 lib/feedjira/podcast/channel/atom.rb
feedjira-podcast-0.9.6 lib/feedjira/podcast/channel/atom.rb
feedjira-podcast-0.9.5 lib/feedjira/podcast/channel/atom.rb
feedjira-podcast-0.9.4 lib/feedjira/podcast/channel/atom.rb
feedjira-podcast-0.9.3 lib/feedjira/podcast/channel/atom.rb
feedjira-podcast-0.9.2 lib/feedjira/podcast/channel/atom.rb
feedjira-podcast-0.9.1 lib/feedjira/podcast/channel/atom.rb
feedjira-podcast-0.9.0 lib/feedjira/podcast/channel/atom.rb