Class: Milkode::FindGrep::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/milkode/grep/findgrep.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(start_dir) ⇒ Result

Returns a new instance of Result.



32
33
34
35
36
37
# File 'lib/milkode/grep/findgrep.rb', line 32

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.



19
20
21
# File 'lib/milkode/grep/findgrep.rb', line 19

def count
  @count
end

#ignore_filesObject

Returns the value of attribute ignore_files.



30
31
32
# File 'lib/milkode/grep/findgrep.rb', line 30

def ignore_files
  @ignore_files
end

#match_countObject

Returns the value of attribute match_count.



22
23
24
# File 'lib/milkode/grep/findgrep.rb', line 22

def match_count
  @match_count
end

#match_file_countObject

Returns the value of attribute match_file_count.



21
22
23
# File 'lib/milkode/grep/findgrep.rb', line 21

def match_file_count
  @match_file_count
end

#match_filesObject

Returns the value of attribute match_files.



27
28
29
# File 'lib/milkode/grep/findgrep.rb', line 27

def match_files
  @match_files
end

#prune_dirsObject

Returns the value of attribute prune_dirs.



29
30
31
# File 'lib/milkode/grep/findgrep.rb', line 29

def prune_dirs
  @prune_dirs
end

#search_countObject

Returns the value of attribute search_count.



20
21
22
# File 'lib/milkode/grep/findgrep.rb', line 20

def search_count
  @search_count
end

#search_filesObject

Returns the value of attribute search_files.



26
27
28
# File 'lib/milkode/grep/findgrep.rb', line 26

def search_files
  @search_files
end

#search_sizeObject

Returns the value of attribute search_size.



24
25
26
# File 'lib/milkode/grep/findgrep.rb', line 24

def search_size
  @search_size
end

#sizeObject

Returns the value of attribute size.



23
24
25
# File 'lib/milkode/grep/findgrep.rb', line 23

def size
  @size
end

#unreadable_filesObject

Returns the value of attribute unreadable_files.



28
29
30
# File 'lib/milkode/grep/findgrep.rb', line 28

def unreadable_files
  @unreadable_files
end

Instance Method Details



47
48
49
50
51
# File 'lib/milkode/grep/findgrep.rb', line 47

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

#timeObject



43
44
45
# File 'lib/milkode/grep/findgrep.rb', line 43

def time
  @end_time - @start_time 
end

#time_stopObject



39
40
41
# File 'lib/milkode/grep/findgrep.rb', line 39

def time_stop
  @end_time = Time.now
end