diff options
| -rw-r--r-- | lib/zorglub/node.rb | 16 | ||||
| -rw-r--r-- | spec/spec_helper.rb | 22 | 
2 files changed, 20 insertions, 18 deletions
diff --git a/lib/zorglub/node.rb b/lib/zorglub/node.rb index 5ebebc2..ad4408c 100644 --- a/lib/zorglub/node.rb +++ b/lib/zorglub/node.rb @@ -13,18 +13,17 @@ module Zorglub          #          class << self              # -            attr_reader :hooks, :inherited_vars, :layout +            attr_reader :hooks, :inherited_vars, :layout, :engine              #              def inherited sub                  sub.layout! layout||(self==Zorglub::Node ? Config.layout : nil ) -                sub.engine engine +                sub.engine! engine||(self==Zorglub::Node ? Config.engine : nil )                  sub.instance_variable_set :@inherited_vars, {}                  @inherited_vars.each do |s,v| sub.inherited_var s, *v end              end              # -            def engine engine=nil -                @engine = engine unless engine.nil? or engine.empty? -                @engine ||= Config.engine +            def engine! engine +                @engine = engine              end              #              def no_layout! @@ -187,8 +186,11 @@ module Zorglub              @options[:state]          end          # -        def engine engine=nil -            @options[:engine] = engine unless engine.nil? or engine.empty? +        def engine! engine +            @options[:engine] = engine +        end +        # +        def engine              @options[:engine]          end          # diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index b29ce0b..76a8638 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -58,13 +58,13 @@ class Node0 < Zorglub::Node      def with_2args a1, a2      end      def do_render -        engine 'real' +        engine! 'real'      end      def do_partial a1, a2 -        engine 'real' +        engine! 'real'      end      def other_view -        engine 'real' +        engine! 'real'          view r('do_partial')      end      def do_redirect @@ -72,29 +72,29 @@ class Node0 < Zorglub::Node      end      def xml_file          no_layout! -        engine :file +        engine! :file          ext 'xml'      end      def plain_file          no_layout! -        engine :file +        engine! :file          ext 'txt'      end      def engines name          no_layout!          case name          when 'haml' -            engine :haml +            engine! :haml          end      end  end  #  class Node1 < Zorglub::Node      layout! 'layout-1' -    engine 'engine-1' +    engine! 'engine-1'      def index          layout! 'main' -        engine 'engine-2' +        engine! 'engine-2'      end  end  # @@ -115,7 +115,7 @@ class Node3 < Zorglub::Node          Node3.after +=1      end      layout! 'layout-2' -    engine 'engine-2' +    engine! 'engine-2'      def index          (self.class.before-self.class.after).should == 1      end @@ -152,13 +152,13 @@ class Node6 < Zorglub::Node      static true      def no_static          static false -        engine 'static' +        engine! 'static'          view Node0.r('do_render')          Node6.static_cpt+=1          @value = Node6.static_cpt      end      def do_static -        engine 'static' +        engine! 'static'          view Node0.r('do_render')          Node6.static_cpt+=1          @value = Node6.static_cpt  | 
