Class: Lux::Response::Header
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
- #delete(name) ⇒ Object
-
#initialize ⇒ Header
constructor
A new instance of Header.
- #merge(hash) ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize ⇒ Header
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
#data ⇒ Object (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_h ⇒ Object
30 31 32 |
# File 'lib/lux/response/lib/header.rb', line 30 def to_h @data end |