class Mail2FrontMatter::PreProcessor
Public Class Methods
process(metadata, body)
click to toggle source
# File lib/mail2frontmatter/preprocessor.rb, line 23 def self.process(metadata, body) @@processors.each do |processor| begin metadata, body = processor.run(metadata, body) rescue StandardError => e Mail2FrontMatter.logger.error('processor failed!') Mail2FrontMatter.logger.error(e) end end [metadata, body] end
processors()
click to toggle source
# File lib/mail2frontmatter/preprocessor.rb, line 11 def self.processors @@processors end
register(options = {})
click to toggle source
# File lib/mail2frontmatter/preprocessor.rb, line 15 def self.register(options = {}) fail InvalidProcessor, "run method not defined on #{self}" unless self.respond_to?(:run) fail ArgumentError, 'options must be a hash' unless options.is_a? Hash @options = options @@processors << self end