lib/backgrounded.rb in backgrounded-0.3.1 vs lib/backgrounded.rb in backgrounded-0.4.1
- old
+ new
@@ -1,37 +1,14 @@
-require 'activesupport'
+require 'active_support/all'
+require File.join(File.dirname(__FILE__), 'backgrounded', 'class_methods')
+require File.join(File.dirname(__FILE__), 'backgrounded', 'handler', 'inprocess_handler')
+
+Object.send(:include, Backgrounded::ClassMethods)
+
module Backgrounded
mattr_accessor :handler
def self.handler
@@handler ||= Backgrounded::Handler::InprocessHandler.new
end
-
- autoload :Handler, 'handler'
-
- module Model
- def self.included(base)
- base.extend(ClassMethods)
- end
-
- module ClassMethods
- def backgrounded(*methods)
- methods.each do |method|
- method_basename, punctuation = method.to_s.sub(/([?!=])$/, ''), $1
- define_method :"#{method_basename}_backgrounded#{punctuation}" do |*args|
- Backgrounded.handler.request(self, method, *args)
- end
- end
- include Backgrounded::Model::InstanceMethods
- extend Backgrounded::Model::SingletonMethods
- end
- end
-
- module SingletonMethods
- end
-
- module InstanceMethods
- end
- end
end
-Object.send(:include, Backgrounded::Model)