Class: Pose::Jobs::Remove

Inherits:
Object
  • Object
show all
Defined in:
lib/pose/jobs/remove.rb

Overview

Removes the Pose search index for the given class.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(clazz) ⇒ Remove

Returns a new instance of Remove.

Parameters:

  • clazz (String, Class)


11
12
13
14
15
16
17
18
19
20
# File 'lib/pose/jobs/remove.rb', line 11

def initialize(clazz)
  @klass = case clazz
             when String
               clazz.constantize
             when Class
               clazz
             else
               raise ArgumentError, "Class or String expected, #{clazz.class} given"
           end
end

Instance Attribute Details

#klassObject (readonly)

Returns the value of attribute klass.



8
9
10
# File 'lib/pose/jobs/remove.rb', line 8

def klass
  @klass
end

Instance Method Details

#performObject



22
23
24
25
# File 'lib/pose/jobs/remove.rb', line 22

def perform
  Pose::Assignment.delete_class_index(klass)
  puts "Search index for class #{klass.name} deleted.\n\n"
end