Sha256: b7e883d0b33c9237e9ac925bae288ce757a37c8bb95f132461f15f848ea91e9e

Contents?: true

Size: 837 Bytes

Versions: 13

Compression:

Stored size: 837 Bytes

Contents

# encoding: utf-8
module Mail

  # Field List class provides an enhanced array that keeps a list of 
  # email fields in order.  And allows you to insert new fields without
  # having to worry about the order they will appear in.
  class FieldList < Array

    include Enumerable

    # Insert the field in sorted order.
    #
    # Heavily based on bisect.insort from Python, which is:
    #   Copyright (C) 2001-2013 Python Software Foundation.
    #   Licensed under <http://docs.python.org/license.html>
    #   From <http://hg.python.org/cpython/file/2.7/Lib/bisect.py>
    def <<( new_field )
      lo = 0
      hi = size

      while lo < hi
        mid = (lo + hi).div(2)
        if new_field < self[mid]
          hi = mid
        else
          lo = mid + 1
        end
      end

      insert(lo, new_field)
    end
  end
end

Version data entries

13 entries across 12 versions & 6 rubygems

Version Path
mail-2.6.4.rc2 lib/mail/field_list.rb
angular-rails4-templates-0.4.1 vendor/ruby/2.1.0/gems/mail-2.6.3/lib/mail/field_list.rb
angular-rails4-templates-0.4.0 vendor/ruby/2.1.0/gems/mail-2.6.3/lib/mail/field_list.rb
tdiary-4.2.1 vendor/bundle/ruby/2.2.0/gems/mail-2.6.3/lib/mail/field_list.rb
tdiary-4.2.1 vendor/bundle/ruby/2.3.0/gems/mail-2.6.3/lib/mail/field_list.rb
angular-rails4-templates-0.3.0 vendor/ruby/2.1.0/gems/mail-2.6.3/lib/mail/field_list.rb
mail-2.6.4.rc1 lib/mail/field_list.rb
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/mail-2.6.3/lib/mail/field_list.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/mail-2.6.3/lib/mail/field_list.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/mail-2.6.3/lib/mail/field_list.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/mail-2.6.3/lib/mail/field_list.rb
shoppe-paypal-1.1.0 vendor/bundle/ruby/2.1.0/gems/mail-2.6.3/lib/mail/field_list.rb
mail-2.6.3 lib/mail/field_list.rb