[ruby off rails] 过程式sinatra
花花公子
2010-07-21
require 'sinatra/base' require 'haml' index_xml = lambda do '<?xml version="1.0"?><xml>content</xml>' end App = Class.new Sinatra::Base App.get '/index.xml', &index_xml App.get '/' do haml :index end |
|
花花公子
2010-07-23
正统面向对象式,还是面向对象写起来方便
require 'sinatra/base' require 'haml' class App < Sinatra::Base def index_xml '<?xml version="1.0"?><xml>content</xml>' end get '/index.xml' do index_xml end get '/' do haml :index end end |
|
鹤惊昆仑
2010-08-21
OO看着更好
|