Parent

Class Index [+]

Quicksearch

HeaderHash

A case-insensitive Hash that preserves the original case of a header when set.

Public Class Methods

new(hash={}) click to toggle source

(Not documented)

     # File lib/rack/utils.rb, line 266
266:       def self.new(hash={})
267:         HeaderHash === hash ? hash : super(hash)
268:       end
new(hash={}) click to toggle source

(Not documented)

     # File lib/rack/utils.rb, line 270
270:       def initialize(hash={})
271:         super()
272:         @names = {}
273:         hash.each { |k, v| self[k] = v }
274:       end

Public Instance Methods

[](k) click to toggle source

(Not documented)

     # File lib/rack/utils.rb, line 293
293:       def [](k)
294:         super(@names[k] ||= @names[k.downcase])
295:       end
[]=(k, v) click to toggle source

(Not documented)

     # File lib/rack/utils.rb, line 297
297:       def []=(k, v)
298:         delete k
299:         @names[k] = @names[k.downcase] = k
300:         super k, v
301:       end
delete(k) click to toggle source

(Not documented)

     # File lib/rack/utils.rb, line 303
303:       def delete(k)
304:         canonical = k.downcase
305:         result = super @names.delete(canonical)
306:         @names.delete_if { |name,| name.downcase == canonical }
307:         result
308:       end
each() click to toggle source

(Not documented)

     # File lib/rack/utils.rb, line 276
276:       def each
277:         super do |k, v|
278:           yield(k, v.respond_to?(:to_ary) ? v.to_ary.join("\n") : v)
279:         end
280:       end
has_key?(k) click to toggle source

Alias for include?

include?(k) click to toggle source

(Not documented)

     # File lib/rack/utils.rb, line 310
310:       def include?(k)
311:         @names.include?(k) || @names.include?(k.downcase)
312:       end
Also aliased as: has_key?, member?, key?
key?(k) click to toggle source

Alias for include?

member?(k) click to toggle source

Alias for include?

merge(other) click to toggle source

(Not documented)

     # File lib/rack/utils.rb, line 323
323:       def merge(other)
324:         hash = dup
325:         hash.merge! other
326:       end
merge!(other) click to toggle source

(Not documented)

     # File lib/rack/utils.rb, line 318
318:       def merge!(other)
319:         other.each { |k, v| self[k] = v }
320:         self
321:       end
replace(other) click to toggle source

(Not documented)

     # File lib/rack/utils.rb, line 328
328:       def replace(other)
329:         clear
330:         other.each { |k, v| self[k] = v }
331:         self
332:       end
to_hash() click to toggle source

(Not documented)

     # File lib/rack/utils.rb, line 282
282:       def to_hash
283:         inject({}) do |hash, (k,v)|
284:           if v.respond_to? :to_ary
285:             hash[k] = v.to_ary.join("\n")
286:           else
287:             hash[k] = v
288:           end
289:           hash
290:         end
291:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.