| 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. This speeds up subsequent lookups for the same word, but also uses memory.
# File lib/coderay/helpers/word_list.rb, line 103
103: def initialize default = false, caching = false
104: if caching
105: super(default, false) do |h, k|
106: h[k] = h.fetch k.downcase, default
107: end
108: else
109: super(default, false)
110: extend Uncached
111: end
112: end