lib/lotus/view/rendering/layout_scope.rb in lotus-view-0.4.1 vs lib/lotus/view/rendering/layout_scope.rb in lotus-view-0.4.2

- old
+ new

@@ -201,12 +201,12 @@ # # `article` will be looked up in the view scope first. # # If not found, it will be searched within the layout. def method_missing(m, *args, &blk) if @scope.respond_to?(m) @scope.__send__(m, *args, &blk) - elsif @layout.respond_to?(m) - @layout.__send__(m, *args, &blk) + elsif layout.respond_to?(m) + layout.__send__(m, *args, &blk) else super end rescue ::NameError ::Kernel.raise ::NoMethodError.new("undefined method `#{ m }' for #{ self.inspect }", m) @@ -225,9 +225,15 @@ options.dup.tap do |opts| opts.merge!(format: format) opts[:locals] = locals opts[:locals].merge!(options.fetch(:locals){ ::Hash.new }) end + end + + # @since 0.4.2 + # @api private + def layout + @layout || @layout.class.layout.new(@scope, "") end end end end end