Class: Glark::InputSpec

Inherits:
Object
  • Object
show all
Defined in:
lib/glark/input/spec.rb

Direct Known Subclasses

InputOptions

Constant Summary collapse

VALID_BINARY_FILE_TYPES =
[ 'text', 'without-match', 'skip', 'binary', 'list', 'decompress', 'read' ]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeInputSpec

Returns a new instance of InputSpec.



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/glark/input/spec.rb', line 23

def initialize
  @binary_files = 'skip'
  @directory = 'list'
  @exclude_matching = false

  @range = Range.new
  @split_as_path = true
  
  @file_criteria = FileCriteriaOpts.new
  @dir_criteria = DirCriteriaOpts.new nil

  @max_depth = 0            # list directories

  $/ = "\n"
end

Instance Attribute Details

#binary_filesObject

how to handle binary files



13
14
15
# File 'lib/glark/input/spec.rb', line 13

def binary_files
  @binary_files
end

#dir_criteriaObject

Returns the value of attribute dir_criteria.



19
20
21
# File 'lib/glark/input/spec.rb', line 19

def dir_criteria
  @dir_criteria
end

#directoryObject

read, skip, or recurse, a la grep



14
15
16
# File 'lib/glark/input/spec.rb', line 14

def directory
  @directory
end

#exclude_matchingObject

exclude files whose names match the expression



15
16
17
# File 'lib/glark/input/spec.rb', line 15

def exclude_matching
  @exclude_matching
end

#file_criteriaObject

Returns the value of attribute file_criteria.



20
21
22
# File 'lib/glark/input/spec.rb', line 20

def file_criteria
  @file_criteria
end

#max_depthObject

Returns the value of attribute max_depth.



21
22
23
# File 'lib/glark/input/spec.rb', line 21

def max_depth
  @max_depth
end

#rangeObject

range to start and stop searching; nil => the entire file



16
17
18
# File 'lib/glark/input/spec.rb', line 16

def range
  @range
end

#split_as_pathObject

use file arguments as path elements



17
18
19
# File 'lib/glark/input/spec.rb', line 17

def split_as_path
  @split_as_path
end