Sha256: 70d6c647b9d1b935a546e312d57d5f9846bb702b62854ed0c2257004797e9f29

Contents?: true

Size: 408 Bytes

Versions: 4

Compression:

Stored size: 408 Bytes

Contents

module Dkim
  class HeaderList
    include Enumerable
    def initialize headers
      @headers = headers.split(/\r?\n(?!([ \t]))/).map do |header|
        key, value = header.split(':', 2)
        Header.new(key, value)
      end
    end
    def [](key)
      @headers.detect do |header|
        header.relaxed_key == key
      end
    end
    def each(&block)
      @headers.each(&block)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
dkim-0.2.0 lib/dkim/header_list.rb
dkim-0.1.0 lib/dkim/header_list.rb
dkim-0.0.3 lib/dkim/header_list.rb
dkim-0.0.2 lib/dkim/header_list.rb