Class: SPDY::Protocol::NV

Inherits:
BinData::Record
  • Object
show all
Defined in:
lib/spdy/protocol.rb

Instance Method Summary collapse

Instance Method Details

#create(opts = {}) ⇒ Object



247
248
249
250
251
252
253
254
# File 'lib/spdy/protocol.rb', line 247

def create(opts = {})
  opts.each do |k, v|
    self.headers << {:name_len => k.size, :name_data => k, :value_len => v.size, :value_data => v}
  end

  self.pairs = opts.size
  self
end

#to_hObject



256
257
258
259
260
261
# File 'lib/spdy/protocol.rb', line 256

def to_h
  headers.inject({}) do |h, v|
    h[v.name_data.to_s] = v.value_data.to_s
    h
  end
end