Sha256: 33fe77e27e51a59f4d67e1ddb03f18b5bbb0676ae684db57c62365b2eb18c6bd

Contents?: true

Size: 564 Bytes

Versions: 3

Compression:

Stored size: 564 Bytes

Contents

# Pre-processes blog data, allows hooks

module Mail2FrontMatter
  class PreProcessor
    require 'set'

    class InvalidProcessor < StandardError ; end

    @@processors = Set.new

    def self.register(options = {})
      raise InvalidProcessor, "run method not defined on #{self}" if !self.respond_to?(:run)
      @options = options

      @@processors << self
    end

    def self.process(metadata, body)
      @@processors.each do |processor|
        metadata, body = processor.run(metadata, body)
      end

      return metadata, body
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mail2frontmatter-0.0.4 lib/mail2frontmatter/preprocessor.rb
mail2frontmatter-0.0.3 lib/mail2frontmatter/preprocessor.rb
mail2frontmatter-0.0.2 lib/mail2frontmatter/preprocessor.rb