Class: BashDebug

Inherits:
Object show all
Defined in:
lib/bash_debug.rb

Class Method Summary collapse

Class Method Details

.checkObject



40
41
42
43
44
45
# File 'lib/bash_debug.rb', line 40

def check
  get_ctn
  get_functions
  get_shortcuts
  check_repeat
end

.check_repeatObject



22
23
24
25
26
27
# File 'lib/bash_debug.rb', line 22

def check_repeat
  repeat = shortcuts - (shortcuts - functions)
  unless repeat.empty?
    puts repeat
  end
end

.ctnObject



52
53
54
55
# File 'lib/bash_debug.rb', line 52

def ctn
  @ctn.uniq! if @ctn.respond_to?(:uniq!)
  @ctn ||= ''
end

.function_regexpObject



10
11
12
# File 'lib/bash_debug.rb', line 10

def function_regexp
  %r{^(?<function>(_|\w)+)\s\(\)\s}
end

.functionsObject



29
30
31
32
33
# File 'lib/bash_debug.rb', line 29

def functions
  @funcitons.flatten! if @funcitons.respond_to?(:flatten!)
  @funcitons.uniq! if @funcitons.respond_to?(:uniq!)
  @funcitons ||= []
end

.get_ctnObject



47
48
49
50
# File 'lib/bash_debug.rb', line 47

def get_ctn
  path = File.join(RoCommands.root, 'ro_commands.sh')
  @ctn = File.read(path)
end

.get_functionsObject



6
7
8
# File 'lib/bash_debug.rb', line 6

def get_functions
  functions << ctn.scan(function_regexp)
end

.get_shortcutsObject



14
15
16
# File 'lib/bash_debug.rb', line 14

def get_shortcuts
  ctn.scan(shortcut_regexp)
end

.shortcut_regexpObject



18
19
20
# File 'lib/bash_debug.rb', line 18

def shortcut_regexp
  %r{alias (?<shortcut>)}
end

.shortcutsObject



35
36
37
38
# File 'lib/bash_debug.rb', line 35

def shortcuts
  @shortcuts.uniq! if @shortcuts.respond_to?(:uniq!)
  @shortcuts ||= []
end