Revision a445b722
Added by Marc Dequènes about 13 years ago
- ID a445b722dd8aefe49872e7748e41c333a48a4b34
lib/cyborghood/cyborg.rb | ||
---|---|---|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
#++
|
||
|
||
require 'cyborghood'
|
||
require 'socket'
|
||
require 'eventmachine'
|
||
require 'thread'
|
||
require 'cyborghood/cyborg/dsl'
|
||
require 'cyborghood/cyborg/task'
|
||
|
||
|
||
module CyborgHood
|
||
module TaskAspect
|
||
def task(name, &block)
|
||
the_bot = self.is_a?(Cyborg) ? self : self.bot
|
||
DSL::Task.new(the_bot, name, &block)
|
||
end
|
||
|
||
def schedule_task(callback = nil, &task)
|
||
EventMachine.defer(task, callback)
|
||
end
|
||
end
|
||
|
||
class Cyborg
|
||
include TaskAspect
|
||
|
Also available in: Unified diff
[cleanup] the revenge of Mr Proper