Class: File

Inherits:
Object
  • Object
show all
Defined in:
lib/automation_object/helpers/file.rb

Overview

Extend file class Collect files in directory recursively and return Array

Class Method Summary collapse

Class Method Details

.collect_files(path) ⇒ Object

Parameters:

  • path (String)

    specified directory path for getting files underneath



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/automation_object/helpers/file.rb', line 9

def collect_files(path)
  raise "Expecting path to exist, got #{path}" unless File.exist?(path)

  if File.directory?(path)
    @file_array = []
    recursive_collection(path)
  else
    @file_array = [path]
  end

  @file_array
end