Skip to content

Commit 5dd7ca6

Browse files
committed
rename CaseIgnoringWordList to WordList::CaseIgnoring
1 parent 5b0d3ed commit 5dd7ca6

File tree

9 files changed

+17
-19
lines changed

9 files changed

+17
-19
lines changed

Changes-1.0.textile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ h3. @WordList@
289289

290290
Stripped down to 19 LOC.
291291

292+
* *RENAMED* @CaseIgnoringWordList@ to @WordList::CaseIgnoring@
292293
* *REMOVED* caching option because it creates memory leaks.
293294
* *REMOVED* block option.
294295

etc/CodeRay.tmproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,20 @@
3737
<string>../README_INDEX.rdoc</string>
3838
<key>lastUsed</key>
3939
<date>2011-08-19T02:16:06Z</date>
40-
<key>selected</key>
41-
<true/>
4240
</dict>
4341
<dict>
4442
<key>filename</key>
4543
<string>../README.textile</string>
4644
<key>lastUsed</key>
47-
<date>2011-08-19T02:05:36Z</date>
45+
<date>2011-08-19T02:29:46Z</date>
46+
<key>selected</key>
47+
<true/>
4848
</dict>
4949
<dict>
5050
<key>filename</key>
5151
<string>../.travis.yml</string>
5252
<key>lastUsed</key>
53-
<date>2011-08-19T02:05:37Z</date>
53+
<date>2011-08-19T02:21:33Z</date>
5454
</dict>
5555
<dict>
5656
<key>filename</key>

lib/coderay/helpers/word_list.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module CodeRay
1515
# WordList is optimized to be used in Scanners,
1616
# typically to decide whether a given ident is a special token.
1717
#
18-
# For case insensitive words use CaseIgnoringWordList.
18+
# For case insensitive words use WordList::CaseIgnoring.
1919
#
2020
# Example:
2121
#
@@ -60,9 +60,9 @@ def add words, value = true
6060
end
6161

6262

63-
# A CaseIgnoringWordList is like a WordList, only that
63+
# A CaseIgnoring WordList is like a WordList, only that
6464
# keys are compared case-insensitively (normalizing keys using +downcase+).
65-
class CaseIgnoringWordList < WordList
65+
class WordList::CaseIgnoring < WordList
6666

6767
def [] key
6868
super key.downcase

lib/coderay/scanner.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
module CodeRay
55

66
autoload :WordList, 'coderay/helpers/word_list'
7-
# FIXME: Rename CaseIgnoringWordList to WordList::CaseIgnoring.
8-
autoload :CaseIgnoringWordList, 'coderay/helpers/word_list'
97

108
# = Scanners
119
#
@@ -155,7 +153,7 @@ def initialize code = '', options = {}
155153
setup
156154
end
157155

158-
# Sets back the scanner. Subclasses should to define the reset_instance
156+
# Sets back the scanner. Subclasses should redefine the reset_instance
159157
# method instead of this one.
160158
def reset
161159
super

lib/coderay/scanners/delphi.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ class Delphi < Scanner
3333
'virtual', 'write', 'writeonly',
3434
] # :nodoc:
3535

36-
IDENT_KIND = CaseIgnoringWordList.new(:ident).
36+
IDENT_KIND = WordList::CaseIgnoring.new(:ident).
3737
add(KEYWORDS, :keyword).
3838
add(DIRECTIVES, :directive) # :nodoc:
3939

40-
NAME_FOLLOWS = CaseIgnoringWordList.new(false).
40+
NAME_FOLLOWS = WordList::CaseIgnoring.new(false).
4141
add(%w(procedure function .)) # :nodoc:
4242

4343
protected

lib/coderay/scanners/html.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class HTML < Scanner
3232
onvolumechange onwaiting
3333
)
3434

35-
IN_ATTRIBUTE = CaseIgnoringWordList.new(nil).
35+
IN_ATTRIBUTE = WordList::CaseIgnoring.new(nil).
3636
add(EVENT_ATTRIBUTES, :script)
3737

3838
ATTR_NAME = /[\w.:-]+/ # :nodoc:
@@ -58,8 +58,7 @@ class HTML < Scanner
5858
'"' => /[^&">\n]+/,
5959
} # :nodoc:
6060

61-
def reset # :nodoc:
62-
# FIXME: why not overwrite reset_instance?
61+
def reset_instance # :nodoc:
6362
super
6463
@state = :initial
6564
end

lib/coderay/scanners/php.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ module Words # :nodoc:
181181
$argc $argv
182182
]
183183

184-
IDENT_KIND = CaseIgnoringWordList.new(:ident).
184+
IDENT_KIND = WordList::CaseIgnoring.new(:ident).
185185
add(KEYWORDS, :keyword).
186186
add(TYPES, :predefined_type).
187187
add(LANGUAGE_CONSTRUCTS, :keyword).

lib/coderay/scanners/sql.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class SQL < Scanner
4242

4343
PREDEFINED_CONSTANTS = %w( null true false )
4444

45-
IDENT_KIND = CaseIgnoringWordList.new(:ident).
45+
IDENT_KIND = WordList::CaseIgnoring.new(:ident).
4646
add(KEYWORDS, :keyword).
4747
add(OBJECTS, :type).
4848
add(COMMANDS, :class).

test/unit/word_list.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ def test_word_list
3939
end
4040

4141
def test_case_ignoring_word_list
42-
list = CaseIgnoringWordList.new(:ident).add(['foobar'], :reserved)
42+
list = WordList::CaseIgnoring.new(:ident).add(['foobar'], :reserved)
4343
assert_equal :ident, list['foo']
4444
assert_equal :reserved, list['foobar']
4545
assert_equal :reserved, list['FooBar']
4646
assert_equal 1, list.size
4747

48-
list = CaseIgnoringWordList.new(:ident).add(['FooBar'], :reserved)
48+
list = WordList::CaseIgnoring.new(:ident).add(['FooBar'], :reserved)
4949
assert_equal :ident, list['foo']
5050
assert_equal :reserved, list['foobar']
5151
assert_equal :reserved, list['FooBar']

0 commit comments

Comments
 (0)