Class: Lux::Response::Header

Inherits:
Object
  • Object
show all
Defined in:
lib/lux/response/lib/header.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeHeader

Returns a new instance of Header.



6
7
8
# File 'lib/lux/response/lib/header.rb', line 6

def initialize
  @data = {}
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



4
5
6
# File 'lib/lux/response/lib/header.rb', line 4

def data
  @data
end

Instance Method Details

#[](key) ⇒ Object



10
11
12
# File 'lib/lux/response/lib/header.rb', line 10

def [] key
  @data[key.downcase]
end

#[]=(key, value) ⇒ Object



14
15
16
# File 'lib/lux/response/lib/header.rb', line 14

def []= key, value
  @data[key.downcase] = value
end

#delete(name) ⇒ Object



26
27
28
# File 'lib/lux/response/lib/header.rb', line 26

def delete name
  @data.delete name.downcase
end

#merge(hash) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/lux/response/lib/header.rb', line 18

def merge hash
  for key, value in hash
    @data[key.downcase] = value
  end

  @data
end

#to_hObject



30
31
32
# File 'lib/lux/response/lib/header.rb', line 30

def to_h
  @data
end