Class: ActiveWorker::Event
- Inherits:
-
Object
- Object
- ActiveWorker::Event
show all
- Includes:
- Behavior::HasRootObject, Mongoid::Document, Mongoid::Timestamps
- Defined in:
- lib/active_worker/event.rb
Class Method Summary
collapse
Instance Method Summary
collapse
#get_root_object_id, included, #notify_root_of_child_started, #notify_root_of_finished, #set_root_object
Class Method Details
.exists_for_configurations?(configurations) ⇒ Boolean
26
27
28
|
# File 'lib/active_worker/event.rb', line 26
def self.exists_for_configurations?(configurations)
where(:configuration_id.in => configurations.map(&:id)).count == configurations.size
end
|
Instance Method Details
#event_type ⇒ Object
38
39
40
|
# File 'lib/active_worker/event.rb', line 38
def event_type
self.class.name.split('::').last.underscore
end
|
#fields_for_view ⇒ Object
30
31
32
33
34
35
36
|
# File 'lib/active_worker/event.rb', line 30
def fields_for_view
view_fields = {}
fields.keys.each do |field|
view_fields[field] = self.send(field)
end
view_fields
end
|
#generate_message ⇒ Object
63
64
65
|
# File 'lib/active_worker/event.rb', line 63
def generate_message
"#{configuration.event_name} base message"
end
|
#get_pid ⇒ Object
48
49
50
|
# File 'lib/active_worker/event.rb', line 48
def get_pid
Process.pid.to_i
end
|
#set_message ⇒ Object
58
59
60
61
|
# File 'lib/active_worker/event.rb', line 58
def set_message
return if message
self.message = generate_message
end
|
42
43
44
45
46
|
# File 'lib/active_worker/event.rb', line 42
def set_process_information
self.host = HostInformation.hostname
self.process_id = get_pid
end
|