ITEMS BY CATEGORY
aphorism(2)
biz(11) in english(6) indian food(16) kaneko(17) korea(21) life and love(23) misc(81) salsa(3) soc(71) tech(52) things(22) travel(16)
Topics With Recent Comments
Archives
June 2008 (1)
May 2008 (2) April 2008 (1) February 2008 (1) December 2007 (1) November 2007 (1) October 2007 (2) September 2007 (3) August 2007 (2) June 2007 (2) May 2006 (1) March 2006 (1) February 2006 (3) December 2005 (1) November 2005 (2) October 2005 (1) August 2005 (8) July 2005 (6) June 2005 (8) May 2005 (5) April 2005 (10) March 2005 (9) February 2005 (5) January 2005 (8) December 2004 (6) November 2004 (5) October 2004 (7) September 2004 (5) August 2004 (3) July 2004 (6) June 2004 (3) May 2004 (19) April 2004 (10) March 2004 (20) February 2004 (7) January 2004 (6) December 2003 (6) November 2003 (7) October 2003 (7) September 2003 (5) August 2003 (8) July 2003 (6) June 2003 (12) May 2003 (12) April 2003 (15) March 2003 (14) February 2003 (11) January 2003 (12) December 2002 (14) November 2002 (15) October 2002 (7)
Recent Entries
Search
A-vertisement
|
May 20, 2008Rubyist九州会議 20086月14日に福岡姪浜にて「Rubyist九州会議 2008」を開催します。 今回は4名の発表者を迎えて行います。 筑波で行われるRubyKaigi 2008と同内容の発表が3本ありますので、
Posted by arai at 01:34 AM
| Comments (0)
May 10, 2008egalite - 1Rubyで新しいウェブアプリケーションフレームワークを書いています。フレームワークは沢山ありますので、私が新しいのを作ったところで話題にはならないでしょうけど、なかなか気に入っているので、完成したら公開したいと思っています。 とりあえず、現時点で稼動しているサンプルコードを載せたいと思います。 プログラム本体。
require 'egalite'
class DefaultController < Egalite::Controller
def get(name = 'egalite')
[
"hello #{name}.",
"cookies = #{cookies.inspect}",
"#{url_for(:action => :bar, :params => [:a,:b])}",
"<a href='test'>template test</a>",
link_to('params test',:action => :test2, :hoge => "p i y o",
"foo[bar][1]" => 1, "foo[bar][2]" => :two),
link_to('add cookie', :action => :set_cookie, :id => :piyopiyo),
link_to('del cookie', :action => :delete_cookie),
].join('<br/>')
end
def test
{:posts => [
{:title => 'piyo', :content => 'hiyoko.'},
{:title => 'foo', :content => 'bar.'},
]}
end
def test2
params.inspect
end
def set_cookie(s)
cookies['test'] = {:expires => Time.now + 3600, :value => s, :path => '/'}
redirect_to('/')
end
def delete_cookie
cookies['test'] = {:expires => Time.now - 3600, :value => nil}
redirect_to('/')
end
end
ShowException = true
RouteDebug = false
egalite = Egalite::Handler.new
Rack::Handler::WEBrick.run(egalite, :Port => 4000)
HTMLページ (pages/test.html)
<html>
<head>
<title>Egalite - A next web application framework on Ruby</title>
</head>
<body>
<h1>Welcome to Egalite</h1>
<group name='posts'>
<h2>&=title;</h2>
<p>&=content;</p>
</group>
</body>
</html>
Posted by arai at 04:49 PM
| Comments (4)
|