summaryrefslogtreecommitdiffstats
path: root/examples/sample.ru
diff options
context:
space:
mode:
Diffstat (limited to 'examples/sample.ru')
-rw-r--r--examples/sample.ru31
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
#