Sha256: 4b1a193066925ed915f02ee8fed076f05289991485b3a41881e1f84be0429de1

Contents?: true

Size: 934 Bytes

Versions: 14

Compression:

Stored size: 934 Bytes

Contents

module Mail::Parsers
  class ContentTransferEncodingParser

    def parse(s)
      content_transfer_encoding = ContentTransferEncodingStruct.new("")
      if s.blank?
        return content_transfer_encoding
      end

      actions, error = Ragel.parse(:content_transfer_encoding, s)
      if error
        raise Mail::Field::ParseError.new(Mail::ContentTransferEncodingElement, s, error)
      end

      encoding_s = nil
      actions.each_slice(2) do |action_id, p|
        action = Mail::Parsers::Ragel::ACTIONS[action_id]
        case action

        # Encoding
        when :encoding_s then encoding_s = p
        when :encoding_e
          content_transfer_encoding.encoding = s[encoding_s..(p-1)].downcase

        else
          raise Mail::Field::ParseError.new(Mail::ContentTransferEncodingElement, s, "Failed to process unknown action: #{action}")
        end
      end

      content_transfer_encoding
    end
  end
end

Version data entries

14 entries across 13 versions & 7 rubygems

Version Path
angular-rails4-templates-0.4.1 vendor/ruby/2.1.0/gems/mail-2.6.3/lib/mail/parsers/content_transfer_encoding_parser.rb
angular-rails4-templates-0.4.0 vendor/ruby/2.1.0/gems/mail-2.6.3/lib/mail/parsers/content_transfer_encoding_parser.rb
tdiary-4.2.1 vendor/bundle/ruby/2.2.0/gems/mail-2.6.3/lib/mail/parsers/content_transfer_encoding_parser.rb
tdiary-4.2.1 vendor/bundle/ruby/2.3.0/gems/mail-2.6.3/lib/mail/parsers/content_transfer_encoding_parser.rb
angular-rails4-templates-0.3.0 vendor/ruby/2.1.0/gems/mail-2.6.3/lib/mail/parsers/content_transfer_encoding_parser.rb
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/mail-2.6.3/lib/mail/parsers/content_transfer_encoding_parser.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/mail-2.6.3/lib/mail/parsers/content_transfer_encoding_parser.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/mail-2.6.3/lib/mail/parsers/content_transfer_encoding_parser.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/mail-2.6.3/lib/mail/parsers/content_transfer_encoding_parser.rb
shoppe-paypal-1.1.0 vendor/bundle/ruby/2.1.0/gems/mail-2.6.3/lib/mail/parsers/content_transfer_encoding_parser.rb
mail-2.6.3 lib/mail/parsers/content_transfer_encoding_parser.rb
mail-portertech-2.6.2.edge lib/mail/parsers/content_transfer_encoding_parser.rb
mail-2.6.1 lib/mail/parsers/content_transfer_encoding_parser.rb
mail-2.6.0 lib/mail/parsers/content_transfer_encoding_parser.rb