Sha256: 94365841a5caef4b16b1b25e282b03fb8f11290e7020b7c0554e426082a66c9f

Contents?: true

Size: 940 Bytes

Versions: 13

Compression:

Stored size: 940 Bytes

Contents

# encoding: utf-8
# This file loads up the parsers for mail to use.  It also will attempt to compile parsers
# if they don't exist.
#
# It also only uses the compiler if we are running the SPEC suite
module Mail # :doc:
  require 'treetop/runtime'

  def self.compile_parser(parser)
    require 'treetop/compiler'
    Treetop.load(File.join(File.dirname(__FILE__)) + "/mail/parsers/#{parser}")
  end

  parsers = %w[ rfc2822_obsolete rfc2822 address_lists phrase_lists
                date_time received message_ids envelope_from rfc2045
                mime_version content_type content_disposition
                content_transfer_encoding content_location ]

  if defined?(MAIL_SPEC_SUITE_RUNNING)
    parsers.each do |parser|
      compile_parser(parser)
    end

  else
    parsers.each do |parser|
      begin
        require "mail/parsers/#{parser}"
      rescue LoadError
        compile_parser(parser)
      end
    end

  end

end

Version data entries

13 entries across 13 versions & 4 rubygems

Version Path
mail-2.5.5 lib/load_parsers.rb
mail-2.5.5.rc1 lib/load_parsers.rb
challah-1.0.0 vendor/bundle/gems/mail-2.5.4/lib/load_parsers.rb
swipe-rails-0.0.5 vendor/bundle/gems/mail-2.5.4/lib/load_parsers.rb
mail-2.5.4 lib/load_parsers.rb
challah-1.0.0.beta3 vendor/bundle/gems/mail-2.5.3/lib/load_parsers.rb
fc-webicons-0.0.4 vendor/bundle/ruby/1.9.1/gems/mail-2.5.3/lib/load_parsers.rb
challah-1.0.0.beta2 vendor/bundle/gems/mail-2.5.3/lib/load_parsers.rb
challah-1.0.0.beta vendor/bundle/gems/mail-2.5.3/lib/load_parsers.rb
fc-webicons-0.0.3 vendor/bundle/ruby/1.9.1/gems/mail-2.5.3/lib/load_parsers.rb
fc-webicons-0.0.2 vendor/bundle/ruby/1.9.1/gems/mail-2.5.3/lib/load_parsers.rb
fc-webicons-0.0.1 vendor/bundle/ruby/1.9.1/gems/mail-2.5.3/lib/load_parsers.rb
mail-2.5.3 lib/load_parsers.rb