Class: Hpack::LookupTable::Entry

Inherits:
Object
  • Object
show all
Defined in:
lib/hpack/lookup_table.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, value = "") ⇒ Entry

Returns a new instance of Entry.



9
10
11
12
# File 'lib/hpack/lookup_table.rb', line 9

def initialize name, value = ""
  @name = name
  @value = value
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



6
7
8
# File 'lib/hpack/lookup_table.rb', line 6

def name
  @name
end

#valueObject

Returns the value of attribute value.



7
8
9
# File 'lib/hpack/lookup_table.rb', line 7

def value
  @value
end

Instance Method Details

#sizeObject



14
15
16
# File 'lib/hpack/lookup_table.rb', line 14

def size
  32 + name.length + value.length
end

#to_aObject



18
19
20
# File 'lib/hpack/lookup_table.rb', line 18

def to_a
  [name, value]
end

#to_sObject



22
23
24
# File 'lib/hpack/lookup_table.rb', line 22

def to_s
  "(s = %4d) %s: %s" % [size, name, value]
end