Class: Fried::Test::Directory::GetFilesByPattern

Inherits:
Object
  • Object
show all
Defined in:
lib/fried/test/directory/get_files_by_pattern.rb

Overview

Behaves like Dir.glob

Defined Under Namespace

Classes: Substitute

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#dirObject

Returns the value of attribute dir.



28
29
30
# File 'lib/fried/test/directory/get_files_by_pattern.rb', line 28

def dir
  @dir
end

Class Method Details

.buildObject



30
31
32
33
34
# File 'lib/fried/test/directory/get_files_by_pattern.rb', line 30

def self.build
  new.tap do |instance|
    instance.dir = Dir
  end
end

.callObject



44
45
46
47
# File 'lib/fried/test/directory/get_files_by_pattern.rb', line 44

def self.call
  instance = build
  instance.()
end

Instance Method Details

#call(pattern, flags = 0) ⇒ Array<String>

Returns:

  • (Array<String>)

See Also:

  • Dir.glob


38
39
40
41
42
# File 'lib/fried/test/directory/get_files_by_pattern.rb', line 38

def call(pattern, flags = 0)
  return [] if dir.nil?

  dir.glob(pattern, flags)
end