Class: Misty::HTTP::Header
- Inherits:
-
Object
- Object
- Misty::HTTP::Header
show all
- Defined in:
- lib/misty/http/header.rb
Defined Under Namespace
Classes: ArgumentError, TypeError
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(param = {}) ⇒ Header
Returns a new instance of Header.
16
17
18
|
# File 'lib/misty/http/header.rb', line 16
def initialize(param = {})
= param if self.class.valid?(param)
end
|
Class Method Details
.valid?(param) ⇒ Boolean
7
8
9
10
11
12
13
14
|
# File 'lib/misty/http/header.rb', line 7
def self.valid?(param)
raise Misty::HTTP::::TypeError unless param.class == Hash
param.each do |key, val|
raise Misty::HTTP::::ArgumentError unless key.class == String
raise Misty::HTTP::::ArgumentError unless val.class == String
end
true
end
|
Instance Method Details
#add(param = {}) ⇒ Object
20
21
22
|
# File 'lib/misty/http/header.rb', line 20
def add(param = {})
.merge!(param) if self.class.valid?(param)
end
|
#get ⇒ Object
24
25
26
|
# File 'lib/misty/http/header.rb', line 24
def get
end
|