Class: Hobix::Search::Simple::SearchResults

Inherits:
Object
  • Object
show all
Defined in:
lib/hobix/search/simple.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSearchResults

Returns a new instance of SearchResults.



42
43
44
45
# File 'lib/hobix/search/simple.rb', line 42

def initialize
  @warnings = []
  @results  = {}
end

Instance Attribute Details

#resultsObject (readonly)

Returns the value of attribute results.



39
40
41
# File 'lib/hobix/search/simple.rb', line 39

def results
  @results
end

#warningsObject (readonly)

Returns the value of attribute warnings.



38
39
40
# File 'lib/hobix/search/simple.rb', line 38

def warnings
  @warnings
end

Instance Method Details

#add_result(name, score) ⇒ Object



51
52
53
# File 'lib/hobix/search/simple.rb', line 51

def add_result(name, score)
  @results[name] = SearchResult.new(name, score)
end

#add_warning(txt) ⇒ Object



47
48
49
# File 'lib/hobix/search/simple.rb', line 47

def add_warning(txt)
  @warnings << txt
end

#contains_matchesObject



55
56
57
# File 'lib/hobix/search/simple.rb', line 55

def contains_matches
  !@results.empty?
end