Sha256: 4b218cb8e2e1ff1f40e5ac59a0d7198b1fd80e872ab69583ff8b0c5fb861ce0a

Contents?: true

Size: 1014 Bytes

Versions: 14

Compression:

Stored size: 1014 Bytes

Contents

module Mail::Parsers
  class ContentLocationParser
    def parse(s)
      content_location = ContentLocationStruct.new(nil)
      if s.blank?
        return content_location
      end

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

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

        # Quoted String.
        when :qstr_s then qstr_s = p
        when :qstr_e then content_location.location = s[qstr_s..(p-1)]

        # Token String
        when :token_string_s then token_string_s = p
        when :token_string_e
          content_location.location = s[token_string_s..(p-1)]

        else
          raise Mail::Field::ParseError.new(Mail::ContentLocationElement, s, "Failed to process unknown action: #{action}")
        end
      end
      content_location
    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_location_parser.rb
angular-rails4-templates-0.4.0 vendor/ruby/2.1.0/gems/mail-2.6.3/lib/mail/parsers/content_location_parser.rb
tdiary-4.2.1 vendor/bundle/ruby/2.2.0/gems/mail-2.6.3/lib/mail/parsers/content_location_parser.rb
tdiary-4.2.1 vendor/bundle/ruby/2.3.0/gems/mail-2.6.3/lib/mail/parsers/content_location_parser.rb
angular-rails4-templates-0.3.0 vendor/ruby/2.1.0/gems/mail-2.6.3/lib/mail/parsers/content_location_parser.rb
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/mail-2.6.3/lib/mail/parsers/content_location_parser.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/mail-2.6.3/lib/mail/parsers/content_location_parser.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/mail-2.6.3/lib/mail/parsers/content_location_parser.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/mail-2.6.3/lib/mail/parsers/content_location_parser.rb
shoppe-paypal-1.1.0 vendor/bundle/ruby/2.1.0/gems/mail-2.6.3/lib/mail/parsers/content_location_parser.rb
mail-2.6.3 lib/mail/parsers/content_location_parser.rb
mail-portertech-2.6.2.edge lib/mail/parsers/content_location_parser.rb
mail-2.6.1 lib/mail/parsers/content_location_parser.rb
mail-2.6.0 lib/mail/parsers/content_location_parser.rb