Powered by SmartDoc

Code (.rb)

Code is Ruby script. The name of component's class must be the same as component's name. Besides, the component's class must inherit CKComponent.

class MainPage < CKComponent
  def sayHello
    "Hello World!"
  end
end

To initialize in component, use init() that initializing method without arguments instead of initialize().

Process of Binding

CGIKit binds elements in template to code. After binding, CGIKit shows HTML by converting the elements. Compoents and elements are changed to HTML like below.

<番号リスト-1->CGIKit reads template of the specified component.

  1. When "<CGIKIT>" is found, CGIKit searches the entry in ckd file which corresponds to the CGIKit tag in template. For example, if "<cgikit name=foo>" is found in template, CGIKit looks for the entry of "foo" in ckd file.
  2. The Elements are bound to code.
  3. The Elements are converted to HTML.

Accessor Method

You need not to define accessor methods for instance variables to use with elements. CGIKit uses accessors if defined, or accesses instance variables directly.

Form Data

In binding, the form data is assinged to the component through the methods to which you bind textfield, button and so on. You don't forget to define accessor methods.