Powered by SmartDoc

mod_ruby

mod_ruby is a module to embed Ruby interpreter in Apache web server. Some processes are needed to use CGIKit with it.

Using with mod_ruby is experimental.

Saving name space of components

If you donft save name space of components in mod_ruby, CGIKit applications can affect each other. Then, create subclasses of CKApplication to save the name space.

Create a new file except a startup script and define a subclass of CKApplication in thi file (loaded in the startup script). Change the subclass name along with the application.

class Application < CKApplication
end

Next, define each components inside the subclass.

class Application
    class MainPage < CKComponent
        ...
    end
end

You can use subclasses of CKApplication but for mod_ruby. If you collect methods related whole of an application into the subclass, you use effectively it because CKApplication objects are shared in each components.

Changing an adapter to CKAdapter::ModRuby

CGIKit communicates with browsers using adapters . By default, CGI and mod_ruby adapters are selected automatically. If you use customized adapter or adapters donft be selected, specify an adapter for interfaceattribute of CKApplication.

#!/usr/local/bin/ruby

require ecgikitf
require eapplicationf

app = Application.new
app.interface = CKAdapter::ModRuby
app.run