Sha256: 07dfa87d238dbd4b48a981f3f307de23a2d78b4fd2d867960fa9324145314a41

Contents?: true

Size: 552 Bytes

Versions: 4

Compression:

Stored size: 552 Bytes

Contents

require 'dkim/header'

module Dkim
  class DkimHeader < Header
    def initialize values={}
      self.key = 'DKIM-Signature'
      @values = values.to_a.flatten.each_slice(2).to_a
    end
    def value
      @values.map do |(k, v)|
        " #{k}=#{v}"
      end.join(';')
    end
    def [] k
      value = @values.detect {|(a,b)| a == k }
      value && value[1]
    end
    def []= k, v
      value = @values.detect {|(a,b)| a == k }
      if !value
        value = [k, nil]
        @values << value
      end
      value[1] = v
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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