Class: Terrazzo::Search

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scoped_resource, dashboard, term) ⇒ Search

Returns a new instance of Search.



5
6
7
8
9
# File 'lib/terrazzo/search.rb', line 5

def initialize(scoped_resource, dashboard, term)
  @scoped_resource = scoped_resource
  @dashboard = dashboard
  @term = term
end

Instance Attribute Details

#dashboardObject (readonly)

Returns the value of attribute dashboard.



3
4
5
# File 'lib/terrazzo/search.rb', line 3

def dashboard
  @dashboard
end

#scoped_resourceObject (readonly)

Returns the value of attribute scoped_resource.



3
4
5
# File 'lib/terrazzo/search.rb', line 3

def scoped_resource
  @scoped_resource
end

#termObject (readonly)

Returns the value of attribute term.



3
4
5
# File 'lib/terrazzo/search.rb', line 3

def term
  @term
end

Instance Method Details

#runObject



11
12
13
14
15
16
17
# File 'lib/terrazzo/search.rb', line 11

def run
  if term.blank?
    scoped_resource
  else
    search_results
  end
end