| Class | CodeRay::CaseIgnoringWordList |
| In: |
lib/coderay/helpers/word_list.rb
|
| Parent: | WordList |
A CaseIgnoringWordList is like a WordList, only that keys are compared case-insensitively.
Ignoring the text case is realized by sending the downcase message to all keys.
Caching usually makes a CaseIgnoringWordList faster, but it has to be activated explicitely.
Creates a new case-insensitive WordList with default as default value.
You can activate caching to store the results for every [] request.
# File lib/coderay/helpers/word_list.rb, line 101
101: def initialize default = false, caching = false
102: if caching
103: super(default, false) do |h, k|
104: h[k] = h.fetch k.downcase, default
105: end
106: else
107: def self.[] key # :nodoc:
108: super(key.downcase)
109: end
110: end
111: end