diff options
| author | Jérémy Zurcher <jeremy@asynk.ch> | 2011-06-16 15:16:01 +0200 | 
|---|---|---|
| committer | Jérémy Zurcher <jeremy@asynk.ch> | 2011-06-16 15:16:01 +0200 | 
| commit | 70bc18d63c63c644dc7239c66f6606ddc4a9b8bc (patch) | |
| tree | 140b50ed3c39856ef87291767191d8dca8df9b5a /examples | |
| parent | d80e07cc22a4ebaee68eb75c90383df0e7789754 (diff) | |
| download | zorglub-70bc18d63c63c644dc7239c66f6606ddc4a9b8bc.zip zorglub-70bc18d63c63c644dc7239c66f6606ddc4a9b8bc.tar.gz  | |
update examples/sample.ru
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/sample.ru | 31 | 
1 files changed, 26 insertions, 5 deletions
diff --git a/examples/sample.ru b/examples/sample.ru index 846bb45..48f59b0 100644 --- a/examples/sample.ru +++ b/examples/sample.ru @@ -1,15 +1,26 @@ -#! /usr/bin/ruby +#! /usr/bin/env ruby  #  $LOAD_PATH << File.join(File.dirname( File.absolute_path(__FILE__)), '..', 'lib')  #  require 'zorglub'  # +Zorglub::Config.register_engine 'my-engine', 'my-ext' +Zorglub::Config.register_engine 'temp-engine', 'tmp' +Zorglub::Config.root = File.dirname( File.absolute_path(__FILE__) ) +#  class Node1 < Zorglub::Node      #      def index a1, *a2 -        response.write "<title>Node1</title>" +        response.write "<title>Node1:index</title>"          response.write "<p>a1 : #{a1.inspect}</p>"          response.write "<p>a2 : #{a2.inspect}</p>" +        response.write self.html +        response.finish +    end +    # +    def alt *args +        response.write "<title>Node1:alt</title>" +        response.write html          response.finish      end      # @@ -22,11 +33,21 @@ end  class Node2 < Zorglub::Node      #      map APP, '/url2' +    engine 'my-engine' +    layout 'my-layout'      # -    def index a1, *a2 +    def index *args          response.write "<title>Node2</title>" -        response.write "<p>a1 : #{a1.inspect}</p>" -        response.write "<p>a2 : #{a2.inspect}</p>" +        response.write html +        response.finish +    end +    # +    def alt *args +        engine 'temp-engine' +        layout 'temp-layout-name' +        view 'path-to-temp-view' +        response.write "<title>Node2:alt</title>" +        response.write html          response.finish      end      #  | 
