diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/zorglub/config.rb | 19 | ||||
| -rw-r--r-- | lib/zorglub/node.rb | 12 | 
2 files changed, 19 insertions, 12 deletions
| diff --git a/lib/zorglub/config.rb b/lib/zorglub/config.rb index 8b5ae37..5c43a1b 100644 --- a/lib/zorglub/config.rb +++ b/lib/zorglub/config.rb @@ -5,14 +5,12 @@ module Zorglub      class Config          @options = {              :root => '.', -            :engine => 'haml', +            :engine => nil,              :view_dir => 'view',              :layout_dir => 'layout',              :default_layout => 'default'          } -        @engines = { -            'haml' => 'haml' -        } +        @engines = { }          class << self              #              def [] k @@ -39,14 +37,21 @@ module Zorglub                  end              end              # -            def register_engine name, ext +            def register_engine name, ext, proc                  return unless name and ext -                @engines[name]=ext +                @engines[name]=[ ext, proc ]              end              #              def engine_ext engine -                @engines[engine] +                e = @engines[engine] +                ( e.nil? ? '' : e[0] ) +            end +            # +            def engine_proc engine +                e = @engines[engine] +                ( e.nil? ? nil : e[1] )              end +            #          end          #          def self.method_missing m, *args, &block diff --git a/lib/zorglub/node.rb b/lib/zorglub/node.rb index 99d6c5d..08214a3 100644 --- a/lib/zorglub/node.rb +++ b/lib/zorglub/node.rb @@ -55,11 +55,13 @@ module Zorglub          end          #          def realize -            # TODO -            #  - use view -            #  - use layout -            r = self.send @action[:method], *@action[:args] -            response.write r +            @content = self.send @action[:method], *@action[:args] +            e = Config.engine_proc @action[:engine] +            v = view +            l = layout +            @content = e.call v, self if e and File.exists? v +            @content = e.call l, self if e and File.exists? l +            response.write @content              response.finish          end          # | 
