Class: DTK::Shell::ContextAux
- Inherits:
-
Object
- Object
- DTK::Shell::ContextAux
- Defined in:
- lib/shell/context_aux.rb
Class Method Summary collapse
-
.count_double_dots(entries) ⇒ Object
returns number of first ‘..’ elements in array.
- .is_double_dot?(command) ⇒ Boolean
Class Method Details
.count_double_dots(entries) ⇒ Object
returns number of first ‘..’ elements in array
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/shell/context_aux.rb', line 29 def count_double_dots(entries) double_dots_count = 0 # we check for '..' and remove them entries.each do |e| if is_double_dot?(e) double_dots_count += 1 else break end end return double_dots_count end |
.is_double_dot?(command) ⇒ Boolean
24 25 26 |
# File 'lib/shell/context_aux.rb', line 24 def is_double_dot?(command) return command.match(/\.\.[\/]?/) end |