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

来源:互联网 发布:养哈士奇 知乎 编辑:程序博客网 时间:2024/04/30 00:08

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  endendRack::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/
0 0