Method: HTTPX::Options#merge

Defined in:
lib/httpx/options.rb

#merge(other) ⇒ Object



128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/httpx/options.rb', line 128

def merge(other)
  h1 = to_hash
  h2 = other.to_hash

  merged = h1.merge(h2) do |k, v1, v2|
    case k
    when :headers, :ssl, :http2_settings, :timeout
      v1.merge(v2)
    else
      v2
    end
  end

  self.class.new(merged)
end