Sha256: e633ccb6f31b9af831b7d340c75c0a755c8724d1812c3c87250aea3afe05431d

Contents?: true

Size: 1.05 KB

Versions: 4

Compression:

Stored size: 1.05 KB

Contents

# frozen_string_literal: true

module Html2rss
  module RssBuilder
    ##
    # Adds XML stylesheet tags (with the provided maker).
    class Stylesheet
      ##
      # Adds the stylesheet XML tags to the RSS.
      #
      # @param maker [RSS::Maker::RSS20] RSS maker object.
      # @param stylesheets [Array<Html2rss::Config::Stylesheet>] Array of stylesheet configurations.
      # @return [nil]
      def self.add(maker, stylesheets)
        stylesheets.each do |stylesheet|
          add_stylesheet(maker, stylesheet)
        end
      end

      ##
      # Adds a single Stylesheet to the RSS.
      #
      # @param maker [RSS::Maker::RSS20] RSS maker object.
      # @param stylesheet [Html2rss::Config::Stylesheet] Stylesheet configuration.
      # @return [nil]
      def self.add_stylesheet(maker, stylesheet)
        maker.xml_stylesheets.new_xml_stylesheet do |xss|
          xss.href = stylesheet.href
          xss.type = stylesheet.type
          xss.media = stylesheet.media
        end
      end

      private_class_method :add_stylesheet
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
html2rss-0.13.0 lib/html2rss/rss_builder/stylesheet.rb
html2rss-0.12.0 lib/html2rss/rss_builder/stylesheet.rb
html2rss-0.11.0 lib/html2rss/rss_builder/stylesheet.rb
html2rss-0.10.0 lib/html2rss/rss_builder/stylesheet.rb