Class: HttpServer::Table
- Inherits:
-
Object
- Object
- HttpServer::Table
- Includes:
- Enumerable
- Defined in:
- lib/xmlrpc/httpserver.rb
Overview
a case-insensitive Hash class for HTTP header
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
- #each ⇒ Object
-
#initialize(hash = {}) ⇒ Table
constructor
A new instance of Table.
- #update(hash) ⇒ Object
- #writeTo(port) ⇒ Object
Constructor Details
#initialize(hash = {}) ⇒ Table
Returns a new instance of Table.
84 85 86 87 |
# File 'lib/xmlrpc/httpserver.rb', line 84 def initialize(hash={}) @hash = hash update(hash) end |
Instance Method Details
#[](key) ⇒ Object
89 90 91 |
# File 'lib/xmlrpc/httpserver.rb', line 89 def [](key) @hash[key.to_s.capitalize] end |
#[]=(key, value) ⇒ Object
93 94 95 |
# File 'lib/xmlrpc/httpserver.rb', line 93 def []=(key, value) @hash[key.to_s.capitalize] = value end |
#each ⇒ Object
102 103 104 |
# File 'lib/xmlrpc/httpserver.rb', line 102 def each @hash.each {|k,v| yield k.capitalize, v } end |
#update(hash) ⇒ Object
97 98 99 100 |
# File 'lib/xmlrpc/httpserver.rb', line 97 def update(hash) hash.each {|k,v| self[k] = v} self end |
#writeTo(port) ⇒ Object
106 107 108 |
# File 'lib/xmlrpc/httpserver.rb', line 106 def writeTo(port) each { |k,v| port << "#{k}: #{v}" << CRLF } end |