wireframe / backgrounded Goto Github PK
View Code? Open in Web Editor NEWsimple background execution of model methods
Home Page: http://blog.codecrate.com/2009/07/backgrounded-background-processing-done.html
License: MIT License
simple background execution of model methods
Home Page: http://blog.codecrate.com/2009/07/backgrounded-background-processing-done.html
License: MIT License
4 positional arguments is unwieldy and should be cleaned up with named arguments.
~/my_src/ruby_apps > mkdir backgrounded
mkdir: создан каталог «backgrounded»
~/my_src/ruby_apps > cd !$
~/my_src/ruby_apps > cd backgrounded
~/my_src/ruby_apps/backgrounded > echo gem \'backgrounded\'>Gemfile
~/my_src/ruby_apps/backgrounded > cat Gemfile
gem 'backgrounded'
~/my_src/ruby_apps/backgrounded > bundle install
Using i18n (0.6.0)
Using multi_json (1.3.4)
Using activesupport (3.2.3)
Using builder (3.0.0)
Using activemodel (3.2.3)
Using arel (3.0.2)
Using tzinfo (0.3.33)
Using activerecord (3.2.3)
Using backgrounded (0.7.5)
Using bundler (1.1.4)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
~/my_src/ruby_apps/backgrounded > irb
1.9.3p194 :001 > require 'rubygems'
=> false
1.9.3p194 :002 > require 'bundler'
=> true
1.9.3p194 :003 > Bundler.setup
=> "GEM\n specs:\n activemodel (3.2.3)\n activesupport (= 3.2.3)\n builder (~> 3.0.0)\n activerecord (3.2.3)\n activemodel (= 3.2.3)\n activesupport (= 3.2.3)\n arel (~> 3.0.2)\n tzinfo (~> 0.3.29)\n activesupport (3.2.3)\n i18n (~> 0.6)\n multi_json (~> 1.0)\n arel (3.0.2)\n backgrounded (0.7.5)\n activerecord (>= 2.3.10)\n activesupport (>= 2.3.10)\n builder (3.0.0)\n i18n (0.6.0)\n multi_json (1.3.4)\n tzinfo (0.3.33)\n\nPLATFORMS\n ruby\n\nDEPENDENCIES\n backgrounded\n"
1.9.3p194 :004 > class User; def hi; puts "Hi"; end; end
=> nil
1.9.3p194 :005 > u = User.new
=> #<User:0x9c0c7a0>
1.9.3p194 :006 > u.hi
Hi
=> nil
1.9.3p194 :007 > u.backgrounded
NoMethodError: undefined method `backgrounded' for #<User:0x9c0c7a0>
from (irb):7
from /usr/local/rvm/rubies/ruby-1.9.3-p194/bin/irb:16:in `<main>'
1.9.3p194 :008 > require 'backgrounded'
=> true
1.9.3p194 :009 > u.backgrounded
=> {}
1.9.3p194 :010 > u.backgrounded.hi
NoMethodError: undefined method `hi' for {}:Hash
from (irb):10
from /usr/local/rvm/rubies/ruby-1.9.3-p194/bin/irb:16:in `<main>'
1.9.3p194 :011 >
So github will not build gems anymore. Why not to move to gemcutter?
Great idea. Thanks for the work, so far.
I'm working on a TorqueboxHandler, but i'm not a great meta-programer, so If anyone has already done any work around this, i'd love to know.
Below is an example of a included mod that backgrounds in TB, but does noting in MRI.
# Wrapper for TorqueBox always_background calls
module Backgroundable
extend ActiveSupport::Concern
included do
if ENV['TORQUEBOX_APP_NAME']
include TorqueBox::Messaging::Backgroundable
end
end
module ClassMethods
if ENV['TORQUEBOX_APP_NAME']
def background_method(method_name)
always_background(method_name)
end
else
def background_method(method_name)
# No op if MRI
end
end
end
end
With DJ 2.0.6
I use an app that is Sinatra based but uses ActiveRecord. I'd like to add this in, but I don't want the overhead of needing all of rails. That and the fact that Sinatra 1.4.7, currently the latest, forces Rack at 1.5. I am using Active Record 5, so its using Rails 5, which needs actionpack 5, which needs rack 2.0, which Sinatra does not support.
If you only required ActiveRecord and Active Support, it would be just as functional, but more compatible, and you'd be requiring less, which is good.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.