Sha256: 1729d9c097b06db1dfb84ec73203915d6d137382472c54d8f92949fe1b248969

Contents?: true

Size: 819 Bytes

Versions: 87

Compression:

Stored size: 819 Bytes

Contents

# frozen_string_literal: true

require 'delegate'

module HTTParty
  class Response #:nodoc:
    class Headers < ::SimpleDelegator
      include ::Net::HTTPHeader

      def initialize(header_values = nil)
        @header = {}
        if header_values
          header_values.each_pair do |k,v|
            if v.is_a?(Array)
              v.each do |sub_v|
                add_field(k, sub_v)
              end
            else
              add_field(k, v)
            end
          end
        end
        super(@header)
      end

      def ==(other)
        if other.is_a?(::Net::HTTPHeader)
          @header == other.instance_variable_get(:@header)
        elsif other.is_a?(Hash)
          @header == other || @header == Headers.new(other).instance_variable_get(:@header)
        end
      end
    end
  end
end

Version data entries

87 entries across 86 versions & 4 rubygems

Version Path
harbr-0.1.61 vendor/bundle/ruby/3.2.0/gems/httparty-0.21.0/lib/httparty/response/headers.rb
harbr-0.1.60 vendor/bundle/ruby/3.2.0/gems/httparty-0.21.0/lib/httparty/response/headers.rb
harbr-0.1.59 vendor/bundle/ruby/3.2.0/gems/httparty-0.21.0/lib/httparty/response/headers.rb
harbr-0.1.58 vendor/bundle/ruby/3.2.0/gems/httparty-0.21.0/lib/httparty/response/headers.rb
harbr-0.1.57 vendor/bundle/ruby/3.2.0/gems/httparty-0.21.0/lib/httparty/response/headers.rb
harbr-0.1.56 vendor/bundle/ruby/3.2.0/gems/httparty-0.21.0/lib/httparty/response/headers.rb
harbr-0.1.55 vendor/bundle/ruby/3.2.0/gems/httparty-0.21.0/lib/httparty/response/headers.rb
harbr-0.1.54 vendor/bundle/ruby/3.2.0/gems/httparty-0.21.0/lib/httparty/response/headers.rb
harbr-0.1.53 vendor/bundle/ruby/3.2.0/gems/httparty-0.21.0/lib/httparty/response/headers.rb
harbr-0.1.52 vendor/bundle/ruby/3.2.0/gems/httparty-0.21.0/lib/httparty/response/headers.rb
harbr-0.1.50 vendor/bundle/ruby/3.2.0/gems/httparty-0.21.0/lib/httparty/response/headers.rb
harbr-0.1.49 vendor/bundle/ruby/3.2.0/gems/httparty-0.21.0/lib/httparty/response/headers.rb
harbr-0.1.48 vendor/bundle/ruby/3.2.0/gems/httparty-0.21.0/lib/httparty/response/headers.rb
harbr-0.1.47 vendor/bundle/ruby/3.2.0/gems/httparty-0.21.0/lib/httparty/response/headers.rb
harbr-0.1.46 vendor/bundle/ruby/3.2.0/gems/httparty-0.21.0/lib/httparty/response/headers.rb
harbr-0.1.45 vendor/bundle/ruby/3.2.0/gems/httparty-0.21.0/lib/httparty/response/headers.rb
harbr-0.1.44 vendor/bundle/ruby/3.2.0/gems/httparty-0.21.0/lib/httparty/response/headers.rb
harbr-0.1.43 vendor/bundle/ruby/3.2.0/gems/httparty-0.21.0/lib/httparty/response/headers.rb
harbr-0.1.42 vendor/bundle/ruby/3.2.0/gems/httparty-0.21.0/lib/httparty/response/headers.rb
harbr-0.1.41 vendor/bundle/ruby/3.2.0/gems/httparty-0.21.0/lib/httparty/response/headers.rb