Class: Madmin::Search
- Inherits:
-
Object
- Object
- Madmin::Search
- Defined in:
- lib/madmin/search.rb
Instance Attribute Summary collapse
-
#query ⇒ Object
readonly
Returns the value of attribute query.
Instance Method Summary collapse
-
#initialize(scoped_resource, resource, term) ⇒ Search
constructor
A new instance of Search.
- #run ⇒ Object
Constructor Details
#initialize(scoped_resource, resource, term) ⇒ Search
Returns a new instance of Search.
7 8 9 10 11 |
# File 'lib/madmin/search.rb', line 7 def initialize(scoped_resource, resource, term) @resource = resource @scoped_resource = scoped_resource @query = term end |
Instance Attribute Details
#query ⇒ Object (readonly)
Returns the value of attribute query.
5 6 7 |
# File 'lib/madmin/search.rb', line 5 def query @query end |
Instance Method Details
#run ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/madmin/search.rb', line 13 def run if query.blank? @scoped_resource.all else search_results(@scoped_resource) end end |