Method: TTY::Tree::PathWalker#initialize
- Defined in:
- lib/tty/tree/path_walker.rb
#initialize(options = {}) ⇒ PathWalker
Create a PathWalker
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/tty/tree/path_walker.rb', line 22 def initialize( = {}) @files_count = 0 @dirs_count = 0 @nodes = [] @filters = [] @level = .fetch(:level) { -1 } @file_limit = .fetch(:file_limit) { - 1 } unless [:show_hidden] add_filter(-> (p) { !p.basename.to_s.start_with?('.') }) end if [:only_dirs] add_filter(-> (p) { p.directory? }) end end |