Class: Grepfruit::SearchResults

Inherits:
Object
  • Object
show all
Defined in:
lib/grepfruit/search_results.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSearchResults

Returns a new instance of SearchResults.



6
7
8
9
10
11
# File 'lib/grepfruit/search_results.rb', line 6

def initialize
  @raw_matches = []
  @total_files = 0
  @total_files_with_matches = 0
  @match_count = 0
end

Instance Attribute Details

#match_countObject (readonly)

Returns the value of attribute match_count.



3
4
5
# File 'lib/grepfruit/search_results.rb', line 3

def match_count
  @match_count
end

#raw_matchesObject (readonly)

Returns the value of attribute raw_matches.



3
4
5
# File 'lib/grepfruit/search_results.rb', line 3

def raw_matches
  @raw_matches
end

#total_filesObject

Returns the value of attribute total_files.



4
5
6
# File 'lib/grepfruit/search_results.rb', line 4

def total_files
  @total_files
end

#total_files_with_matchesObject (readonly)

Returns the value of attribute total_files_with_matches.



3
4
5
# File 'lib/grepfruit/search_results.rb', line 3

def total_files_with_matches
  @total_files_with_matches
end

Instance Method Details

#add_match_count(count) ⇒ Object



17
18
19
# File 'lib/grepfruit/search_results.rb', line 17

def add_match_count(count)
  @match_count += count
end

#add_raw_matches(matches) ⇒ Object



21
22
23
# File 'lib/grepfruit/search_results.rb', line 21

def add_raw_matches(matches)
  @raw_matches.concat(matches)
end

#increment_files_with_matchesObject



13
14
15
# File 'lib/grepfruit/search_results.rb', line 13

def increment_files_with_matches
  @total_files_with_matches += 1
end