Sha256: d02a5cb8c721bf596b193b8ea9960f22fbb2b689eeace8c8238c11e11294455a

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

module Wee

  #
  # Presenter is the superclass of all classes that want to participate in
  # rendering and callback-processing. It merely specifies an interface without
  # actual implementation. 
  #
  # Class Component and Decoration are it's two most important subclasses.
  # 
  class Presenter

    def render!(r)
      r.with(self) {|new_r| render(new_r)}
    end

    def render(r); raise end
    def state(s); raise end

    def process_callbacks(callbacks); raise end

    #
    # Returns the class used as Renderer for this presenter. Overwrite this
    # method if you want to use a different Renderer than the default one.
    #
    # Returned class must be a subclass of Wee::Renderer.
    #
    def renderer_class
      Wee::HtmlCanvas
    end

    protected

    #
    # Returns the current session. A presenter (or component) has always an
    # associated session. The returned object is of class Wee::Session or a
    # subclass thereof.
    #
    def session
      Wee::Session.current
    end

  end # class Presenter

end # module Wee

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mullen-wee-2.2.0 lib/wee/presenter.rb