Class: Dragnet::Explorer

Inherits:
Object
  • Object
show all
Defined in:
lib/dragnet/explorer.rb

Overview

This class searches for Manual Test Record files inside a given path by using the given Glob patterns.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path:, glob_patterns:, logger:) ⇒ Explorer

Creates a new instance of the class.

Parameters:

  • path (Pathname)

    The path that should be explored.

  • glob_patterns (String, Array<String>)

    The glob pattern or glob patterns to use when exploring the specified path.

  • logger (#info)

    A logger object to use for output.

Raises:

  • (ArgumentError)

    If path or glob_patterns are nil or if they don't have one of the expected types.



18
19
20
21
22
23
24
25
# File 'lib/dragnet/explorer.rb', line 18

def initialize(path:, glob_patterns:, logger:)
  validate_path(path)
  validate_patterns(glob_patterns)

  @path = path
  @glob_patterns = *glob_patterns
  @logger = logger
end

Instance Attribute Details

#glob_patternsObject (readonly)

Returns the value of attribute glob_patterns.



9
10
11
# File 'lib/dragnet/explorer.rb', line 9

def glob_patterns
  @glob_patterns
end

#loggerObject (readonly)

Returns the value of attribute logger.



9
10
11
# File 'lib/dragnet/explorer.rb', line 9

def logger
  @logger
end

#pathObject (readonly)

Returns the value of attribute path.



9
10
11
# File 'lib/dragnet/explorer.rb', line 9

def path
  @path
end

Instance Method Details

#filesArray<Pathname>

Performs the search for MTR files and returns an array with the found

files.

Returns:

  • (Array<Pathname>)

    The array of found MTR files.

Raises:



31
32
33
# File 'lib/dragnet/explorer.rb', line 31

def files
  @files ||= find_files
end