Sha256: fb60ae1b2b09ce08cefa4196569e4c5b13e52fded0ed996a6379625aaf735a24
Contents?: true
Size: 1.14 KB
Versions: 1
Compression:
Stored size: 1.14 KB
Contents
# frozen_string_literal: true module Html2rss ## # Provides a namespace for attribute post processors. module AttributePostProcessors ## # Error raised when an unknown post processor name is requested. class UnknownPostProcessorName < StandardError; end ## # Maps the post processor name to the class implementing the post processor. # # The key is the name to use in the feed config. NAME_TO_CLASS = { gsub: Gsub, html_to_markdown: HtmlToMarkdown, markdown_to_html: MarkdownToHtml, parse_time: ParseTime, parse_uri: ParseUri, sanitize_html: SanitizeHtml, substring: Substring, template: Template }.freeze ## # Retrieves the attribute post processor class based on the given name. # # @param name [Symbol] The name of the post processor. # @return [Class] The attribute post processor class. # @raise [UnknownPostProcessorName] If the requested name is not found in NAME_TO_CLASS. def self.get_processor(name) NAME_TO_CLASS[name.to_sym] || raise(UnknownPostProcessorName, "Can't find a post processor named '#{name}'") end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
html2rss-0.10.0 | lib/html2rss/attribute_post_processors.rb |