class Mail2FrontMatter::AutomaticEmbed

Public Class Methods

register(options = {}) click to toggle source
Calls superclass method
# File lib/mail2frontmatter/automatic-embeds.rb, line 13
def self.register(options = {})
  super

  # I *could* introspect on auto_html here but I haven't vetted them all yet
  if @options[:white_list]
    @filters = @options[:white_list].map(&:to_sym)
  elsif @options[:black_list]
    @filters = @all_filters - @options[:black_list].map(&:to_sym)
  else
    @filters = @all_filters
  end

end
run(metadata, body) click to toggle source
# File lib/mail2frontmatter/automatic-embeds.rb, line 27
def self.run(metadata, body)
  body = unwrap_links(body)

  body = auto_html(body, { filters: @filters, options: @options[:filters] }) { 
    # use options passed to us...
    @options[:filters].each do |filter|
      options_for_filter = @options[:options] ? (@options[:options][filter.to_sym] || {}) : {}
      self.send(filter.to_sym, options_for_filter)
    end

    # be sure to return @text here
    @text
  }

  return metadata, body
end