Class: BashDebug
Class Method Summary collapse
- .check ⇒ Object
- .check_repeat ⇒ Object
- .ctn ⇒ Object
- .function_regexp ⇒ Object
- .functions ⇒ Object
- .get_ctn ⇒ Object
- .get_functions ⇒ Object
- .get_shortcuts ⇒ Object
- .shortcut_regexp ⇒ Object
- .shortcuts ⇒ Object
Class Method Details
.check ⇒ Object
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_repeat ⇒ Object
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 |
.ctn ⇒ Object
52 53 54 55 |
# File 'lib/bash_debug.rb', line 52 def ctn @ctn.uniq! if @ctn.respond_to?(:uniq!) @ctn ||= '' end |
.function_regexp ⇒ Object
10 11 12 |
# File 'lib/bash_debug.rb', line 10 def function_regexp %r{^(?<function>(_|\w)+)\s\(\)\s} end |
.functions ⇒ Object
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_ctn ⇒ Object
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_functions ⇒ Object
6 7 8 |
# File 'lib/bash_debug.rb', line 6 def get_functions functions << ctn.scan(function_regexp) end |
.get_shortcuts ⇒ Object
14 15 16 |
# File 'lib/bash_debug.rb', line 14 def get_shortcuts ctn.scan(shortcut_regexp) end |
.shortcut_regexp ⇒ Object
18 19 20 |
# File 'lib/bash_debug.rb', line 18 def shortcut_regexp %r{alias (?<shortcut>)} end |
.shortcuts ⇒ Object
35 36 37 38 |
# File 'lib/bash_debug.rb', line 35 def shortcuts @shortcuts.uniq! if @shortcuts.respond_to?(:uniq!) @shortcuts ||= [] end |