Class: Ecm::Tags::TagSearch

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Model
Defined in:
app/models/ecm/tags/tag_search.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#exactObject

Returns the value of attribute exact.



5
6
7
# File 'app/models/ecm/tags/tag_search.rb', line 5

def exact
  @exact
end

#resultObject

Returns the value of attribute result.



5
6
7
# File 'app/models/ecm/tags/tag_search.rb', line 5

def result
  @result
end

#tag_listObject

Returns the value of attribute tag_list.



5
6
7
# File 'app/models/ecm/tags/tag_search.rb', line 5

def tag_list
  @tag_list
end

#taggable_classesObject

Returns the value of attribute taggable_classes.



5
6
7
# File 'app/models/ecm/tags/tag_search.rb', line 5

def taggable_classes
  @taggable_classes
end

Class Method Details

.call(*args) ⇒ Object



9
10
11
# File 'app/models/ecm/tags/tag_search.rb', line 9

def self.call(*args)
  new(*args).do_work
end

.i18n_scopeObject



13
14
15
# File 'app/models/ecm/tags/tag_search.rb', line 13

def self.i18n_scope
  :activerecord
end

Instance Method Details

#do_workObject



17
18
19
20
21
22
23
24
25
26
# File 'app/models/ecm/tags/tag_search.rb', line 17

def do_work
  say "#{self.class.name} running..."
  output = result
  output.each do |klass, resources|
    say "Found #{resources.size} #{klass.constantize.model_name.human(count: :other)}:", indent: 1
    say resources.inspect, indent: 2
  end
  say 'done'
  output
end

#result!Object



36
37
38
39
# File 'app/models/ecm/tags/tag_search.rb', line 36

def result!
  @result = nil
  result
end