Class: BashDebug
- Inherits:
-
Object
- Object
- BashDebug
- Defined in:
- lib/bash_debug.rb
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
38 39 40 41 42 43 |
# File 'lib/bash_debug.rb', line 38 def check get_ctn get_functions get_shortcuts check_repeat end |
.check_repeat ⇒ Object
20 21 22 23 24 25 |
# File 'lib/bash_debug.rb', line 20 def check_repeat repeat = shortcuts - (shortcuts - functions) unless repeat.empty? puts repeat end end |
.ctn ⇒ Object
50 51 52 53 |
# File 'lib/bash_debug.rb', line 50 def ctn @ctn.uniq! if @ctn.respond_to?(:uniq!) @ctn ||= '' end |
.function_regexp ⇒ Object
8 9 10 |
# File 'lib/bash_debug.rb', line 8 def function_regexp %r{^(?<function>(_|\w)+)\s\(\)\s} end |
.functions ⇒ Object
27 28 29 30 31 |
# File 'lib/bash_debug.rb', line 27 def functions @funcitons.flatten! if @funcitons.respond_to?(:flatten!) @funcitons.uniq! if @funcitons.respond_to?(:uniq!) @funcitons ||= [] end |
.get_ctn ⇒ Object
45 46 47 48 |
# File 'lib/bash_debug.rb', line 45 def get_ctn path = File.join($root, 'ro_commands.sh') @ctn = File.read(path) end |
.get_functions ⇒ Object
4 5 6 |
# File 'lib/bash_debug.rb', line 4 def get_functions functions << ctn.scan(function_regexp) end |
.get_shortcuts ⇒ Object
12 13 14 |
# File 'lib/bash_debug.rb', line 12 def get_shortcuts ctn.scan(shortcut_regexp) end |
.shortcut_regexp ⇒ Object
16 17 18 |
# File 'lib/bash_debug.rb', line 16 def shortcut_regexp %r{alias (?<shortcut>)} end |
.shortcuts ⇒ Object
33 34 35 36 |
# File 'lib/bash_debug.rb', line 33 def shortcuts @shortcuts.uniq! if @shortcuts.respond_to?(:uniq!) @shortcuts ||= [] end |