Sha256: 1adda53dafd7430fae853d61fb0ec2660de861850358ee4ce0deaf0681fd1381
Contents?: true
Size: 652 Bytes
Versions: 3
Compression:
Stored size: 652 Bytes
Contents
module Backgrounded module ClassMethods def backgrounded(*args) options = args.extract_options! methods_with_options = args.inject({}) do |hash, method| hash[method] = {}; hash end methods_with_options.merge! options methods_with_options.each_pair do |method, options| method_basename, punctuation = method.to_s.sub(/([?!=])$/, ''), $1 define_method "#{method_basename}_backgrounded#{punctuation}" do |*args| Backgrounded.handler.request(self, method, *args) end end cattr_accessor :backgrounded_options self.backgrounded_options = methods_with_options end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
backgrounded-0.6.1 | lib/backgrounded/class_methods.rb |
backgrounded-0.6.0 | lib/backgrounded/class_methods.rb |
backgrounded-0.5.0 | lib/backgrounded/class_methods.rb |