ruby 异步事件驱动的Ruby Web应用框架 Cramp

Cramp是一种新的,处 理并发事件的Web应用程序框架,由37signals和Rails核心小组的Pratik Naik提供。它建立在Ruby的EventMachine库之上,主要用于处理一些大量的开放连接 (如Comet系统或streaming APIs),整个过程都使用event-driven I/O。

Cramp使用Rails 3.0的ActiveSupport 和 ActiveModel库, 它会显示两层用于开发:controllers 和 models。

示例代码:

require 'rubygems'
require 'cramp/controller'

class WelcomeAction < Cramp::Controller::Action
  on_start :send_hello_world

  def send_hello_world
    render "Hello World"
    finish
  end
end

Rack::Handler::Thin.run WelcomeAction, :Port => 3000

安装方法:

gem install arel --pre
gem install activemodel --pre

And then,

gem install cramp

转自:http://www.oschina.net/p/cramp/

你可能感兴趣的:(ruby 异步事件驱动的Ruby Web应用框架 Cramp)