Class: Smalltalk::Search
- Inherits:
-
Object
- Object
- Smalltalk::Search
- Defined in:
- lib/smalltalk/search.rb
Instance Attribute Summary collapse
-
#search ⇒ Object
Returns the value of attribute search.
Instance Method Summary collapse
-
#initialize(search) ⇒ Search
constructor
A new instance of Search.
- #run! ⇒ Object
Constructor Details
#initialize(search) ⇒ Search
Returns a new instance of Search.
7 8 9 |
# File 'lib/smalltalk/search.rb', line 7 def initialize(search) self.search = search end |
Instance Attribute Details
#search ⇒ Object
Returns the value of attribute search.
5 6 7 |
# File 'lib/smalltalk/search.rb', line 5 def search @search end |
Instance Method Details
#run! ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/smalltalk/search.rb', line 11 def run! results = Smalltalk::Message search[:q].split.each do |term| results = results.where("content LIKE :q", q: "%#{term}%") end results end |