Class: Dirfy::IO
- Inherits:
-
Object
- Object
- Dirfy::IO
- Defined in:
- lib/dirfy/io.rb
Overview
Creates directories/files with progress bar, dry-run, verbose modes.
Instance Method Summary collapse
-
#create(items) ⇒ Object
items - Array<String>.
-
#initialize(dry_run: false, verbose: false) ⇒ IO
constructor
A new instance of IO.
Constructor Details
#initialize(dry_run: false, verbose: false) ⇒ IO
Returns a new instance of IO.
7 8 9 10 11 12 |
# File 'lib/dirfy/io.rb', line 7 def initialize(dry_run: false, verbose: false) @dry_run = dry_run @verbose = verbose @dirs = @files = @skipped = @failed = 0 = 30 end |
Instance Method Details
#create(items) ⇒ Object
items - Array<String>
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/dirfy/io.rb', line 15 def create(items) total = items.size items.each_with_index do |item, idx| print_progress(idx + 1, total) if item.end_with?("/") create_dir(item) else create_file(item) end end puts print_summary end |