Re: RubyInitHandler Problems
Shugo Maeda <[email protected]> Thu, 29 Jul 2004 02:15:27 +0900
| Newsgroups | gmane.comp.apache.mod-ruby |
|---|---|
| Message-ID | <[email protected]> |
Hi,
Hammond, Tony wrote:
> ===
> RubyRequire apache/ruby-run
> RubyRequire foo/bar
>
> <Files *.rbx>
> SetHandler ruby-object
> RubyInitHandler Foo::Bar.load_data
> RubyHandler Apache::RubyRun.instance
> </Files>
The parameter of RubyInitHandler should be an expression that returns an
init handler object. Init handler objects should have `init' method.
--- example of init handler ---
require 'singleton'
class MyInitHandler
include Singleton
def init(r)
...
end
end
--------------------------------
You can register this handler like this:
RubyHandler MyInitHandler.instance
`instance' is defined in Singleton, and always returns a same instance
of MyInitHandler.
Shugo