2.5. Constructor Block

Generation of a component and initialization processing can be specified by passing Constructor Block to the s2component method.

require 's2container'

class Action
  attr_accessor :name

s2comp(:class => Action) {
  act = Action.new
  act.name = "foo"
  next act

p s2app.get(Action).name    # -> foo

This Example located in examples/quickstart/quickstart4

© Copyright The Seasar Foundation and the others 2008-2009, all rights reserved.