Class: TermUtils::FF::Query

Inherits:
Object
  • Object
show all
Defined in:
lib/term_utils/ff/query.rb

Overview

Represents a file system query.

Instance Method Summary collapse

Constructor Details

#initializeQuery

Returns a new instance of Query.



23
24
25
# File 'lib/term_utils/ff/query.rb', line 23

def initialize
  @config = TermUtils::FF::Config.new
end

Instance Method Details

#exec(path) ⇒ TermUtils::FF::Cursor

Executes this one.

Parameters:

  • path (String)

Returns:



61
62
63
# File 'lib/term_utils/ff/query.rb', line 61

def exec(path)
  TermUtils::FF::Cursor.new(@config.dup, path).bootstrap
end

#ignore(regexp) ⇒ TermUtils::FF::Query

Adds a Regexp to ignore.

Parameters:

  • regexp (Regexp)

Returns:



33
34
35
36
# File 'lib/term_utils/ff/query.rb', line 33

def ignore(regexp)
  @config.ignore_list << regexp
  self
end

#initialize_copy(other) ⇒ Object



26
27
28
29
# File 'lib/term_utils/ff/query.rb', line 26

def initialize_copy(other)
  @config = other.config.dup
  super
end

#max_depth(depth) ⇒ TermUtils::FF::Query

Sets a maximum depth.

Parameters:

  • depth (Integer)

Returns:



47
48
49
50
# File 'lib/term_utils/ff/query.rb', line 47

def max_depth(depth)
  @config.max_depth = depth
  self
end

#min_depth(depth) ⇒ TermUtils::FF::Query

Sets a minimum depth.

Parameters:

  • depth (Integer)

Returns:



40
41
42
43
# File 'lib/term_utils/ff/query.rb', line 40

def min_depth(depth)
  @config.min_depth = depth
  self
end

#sort(sorted = true) ⇒ TermUtils::FF::Query

Sets whether results shall be sorted.

Parameters:

  • sorted (Boolean) (defaults to: true)

Returns:



54
55
56
57
# File 'lib/term_utils/ff/query.rb', line 54

def sort(sorted = true)
  @config.sorted = sorted
  self
end