Class: Spellr::Interactive
Instance Method Summary
collapse
#counts, #exit_code, #increment, #initialize, #output, #print, #puts, #warn
aqua, bold, color_enabled?, green, normal, pluralize, red
Instance Method Details
#call(token) ⇒ Object
41
42
43
44
45
46
47
48
|
# File 'lib/spellr/interactive.rb', line 41
def call(token)
return if attempt_global_replacement(token)
return if attempt_global_skip(token)
super
prompt(token)
end
|
#finish ⇒ Object
rubocop:disable Metrics/AbcSize, Metrics/MethodLength
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/spellr/interactive.rb', line 16
def finish puts "\n"
puts "#{pluralize 'file', counts[:checked]} checked"
puts "#{pluralize 'error', total} found"
if counts[:total_skipped].positive?
puts "#{pluralize 'error', counts[:total_skipped]} skipped"
end
puts "#{pluralize 'error', counts[:total_fixed]} fixed" if counts[:total_fixed].positive?
puts "#{pluralize 'word', counts[:total_added]} added" if counts[:total_added].positive?
end
|
#global_replacements ⇒ Object
27
28
29
30
31
32
|
# File 'lib/spellr/interactive.rb', line 27
def global_replacements
@global_replacements ||= begin
counts[:global_replacements] = {} unless counts.key?(:global_replacements)
counts[:global_replacements]
end
end
|
#global_skips ⇒ Object
34
35
36
37
38
39
|
# File 'lib/spellr/interactive.rb', line 34
def global_skips
@global_skips ||= begin
counts[:global_skips] = [] unless counts.key?(:global_skips)
counts[:global_skips]
end
end
|
#parallel? ⇒ Boolean
12
13
14
|
# File 'lib/spellr/interactive.rb', line 12
def parallel?
false
end
|
#stdin_getch ⇒ Object
50
51
52
53
54
|
# File 'lib/spellr/interactive.rb', line 50
def stdin_getch
choice = output.stdin.getch
clear_current_line
choice
end
|