class Misty::HTTP::Header

Public Class Methods

new(param = {}) click to toggle source
# File lib/misty/http/header.rb, line 13
def initialize(param = {})
  @headers = param if self.class.valid?(param)
end
valid?(param) click to toggle source
# File lib/misty/http/header.rb, line 4
def self.valid?(param)
  raise TypeError unless param.class == Hash
  param.each do |key, val|
    raise ArgumentError unless key.class == String
    raise ArgumentError unless val.class == String
  end
  true
end

Public Instance Methods

add(param = {}) click to toggle source
# File lib/misty/http/header.rb, line 17
def add(param = {})
  @headers.merge!(param) if self.class.valid?(param)
end
get() click to toggle source
# File lib/misty/http/header.rb, line 21
def get
  @headers
end