Class: Xpub::CallBook::CallChecker
- Inherits:
-
Object
- Object
- Xpub::CallBook::CallChecker
show all
- Defined in:
- lib/xpub/dsl/checker.rb
Instance Method Summary
collapse
Constructor Details
#initialize(name, book) ⇒ CallChecker
Returns a new instance of CallChecker.
5
6
7
8
|
# File 'lib/xpub/dsl/checker.rb', line 5
def initialize(name, book)
@name = name
@book = book
end
|
Instance Method Details
#_check(_option, pattern) ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/xpub/dsl/checker.rb', line 13
def _check(_option, pattern)
words = {}
@book.src_files.each do |file|
f = open file.full_path
f.each_with_index do |line, index|
line.match(pattern) do |md|
if words[md[1]]
words[md[1]] << { file: file.file, line: (index + 1) }
else
words[md[1]] = [{ file: file.file, line: (index + 1) }]
end
end
end
f.close
end
words.sort.each do |word, infos|
next unless word
puts word.color :red
infos.each do |info|
puts " #{info[:file]}(#{info[:line]})"
end
end
end
|
#validate ⇒ Object
10
11
|
# File 'lib/xpub/dsl/checker.rb', line 10
def validate
end
|