s2componentメソッドに、コンポーネントの生成処理を行うコンストラクタ ブロックを渡すことで、コンポーネントの 生成、初期化処理を指定できます。
require 's2container'
class Action
attr_accessor :name
end
s2comp(:class => Action) {
act = Action.new
act.name = "foo"
next act
}
p s2app.get(Action).name # -> foo
![]() | NOTE |
|---|---|
|
この例は example/quickstart/quickstart4 にあります。 |
| © Copyright The Seasar Foundation and the others 2008-2009, all rights reserved. |