Class: FindGrep::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/gren/findgrep/result.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(start_dir) ⇒ Result

Returns a new instance of Result.



21
22
23
24
25
26
# File 'lib/gren/findgrep/result.rb', line 21

def initialize(start_dir)
  @start_dir = File.expand_path(start_dir)
  @count, @search_count, @match_file_count, @match_count, @size, @search_size = 0, 0, 0, 0, 0, 0
  @start_time = Time.now
  @search_files, @match_files, @unreadable_files, @prune_dirs, @ignore_files  = [], [], [], [], []
end

Instance Attribute Details

#countObject

Returns the value of attribute count.



8
9
10
# File 'lib/gren/findgrep/result.rb', line 8

def count
  @count
end

#ignore_filesObject

Returns the value of attribute ignore_files.



19
20
21
# File 'lib/gren/findgrep/result.rb', line 19

def ignore_files
  @ignore_files
end

#match_countObject

Returns the value of attribute match_count.



11
12
13
# File 'lib/gren/findgrep/result.rb', line 11

def match_count
  @match_count
end

#match_file_countObject

Returns the value of attribute match_file_count.



10
11
12
# File 'lib/gren/findgrep/result.rb', line 10

def match_file_count
  @match_file_count
end

#match_filesObject

Returns the value of attribute match_files.



16
17
18
# File 'lib/gren/findgrep/result.rb', line 16

def match_files
  @match_files
end

#prune_dirsObject

Returns the value of attribute prune_dirs.



18
19
20
# File 'lib/gren/findgrep/result.rb', line 18

def prune_dirs
  @prune_dirs
end

#search_countObject

Returns the value of attribute search_count.



9
10
11
# File 'lib/gren/findgrep/result.rb', line 9

def search_count
  @search_count
end

#search_filesObject

Returns the value of attribute search_files.



15
16
17
# File 'lib/gren/findgrep/result.rb', line 15

def search_files
  @search_files
end

#search_sizeObject

Returns the value of attribute search_size.



13
14
15
# File 'lib/gren/findgrep/result.rb', line 13

def search_size
  @search_size
end

#sizeObject

Returns the value of attribute size.



12
13
14
# File 'lib/gren/findgrep/result.rb', line 12

def size
  @size
end

#unreadable_filesObject

Returns the value of attribute unreadable_files.



17
18
19
# File 'lib/gren/findgrep/result.rb', line 17

def unreadable_files
  @unreadable_files
end

Instance Method Details



36
37
38
39
40
# File 'lib/gren/findgrep/result.rb', line 36

def print(stdout)
  stdout.puts "dir   : #{@start_dir} (#{Util::time_s(time)})"
  stdout.puts "files : #{@search_count} in #{@count} (#{Util::size_s(@search_size)} in #{Util::size_s(@size)})"
  stdout.puts "match : #{@match_file_count} files, #{match_count} hit"
end

#timeObject



32
33
34
# File 'lib/gren/findgrep/result.rb', line 32

def time
  @end_time - @start_time 
end

#time_stopObject



28
29
30
# File 'lib/gren/findgrep/result.rb', line 28

def time_stop
  @end_time = Time.now
end