Module: Simultaneous::Task
- Defined in:
- lib/simultaneous/task.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(klass) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/simultaneous/task.rb', line 12 def self.included(klass) Simultaneous.client = Simultaneous::SyncClient.new Simultaneous.set_pid(self.task_name, pid) if task_name at_exit { begin Simultaneous.task_complete(self.task_name) rescue Errno::ECONNREFUSED rescue Errno::ENOENT end # Simultaneous.client.close } rescue Errno::ECONNREFUSED rescue Errno::ENOENT # server isn't running but we don't want this to stop our script end |
.pid ⇒ Object
8 9 10 |
# File 'lib/simultaneous/task.rb', line 8 def self.pid $$ end |
.task_name ⇒ Object
4 5 6 |
# File 'lib/simultaneous/task.rb', line 4 def self.task_name ENV[Simultaneous::ENV_TASK_NAME] end |
Instance Method Details
#simultaneous_event(event, message) ⇒ Object
30 31 32 33 34 35 |
# File 'lib/simultaneous/task.rb', line 30 def simultaneous_event(event, ) Simultaneous.send_event(event, ) rescue Errno::ECONNREFUSED rescue Errno::ENOENT # server isn't running but we don't want this to stop our script end |