From c1aa5b0e14cd4bd27a5d8bd85cf7c36fa5911830 Mon Sep 17 00:00:00 2001 From: Yehuda Katz and Carl Lerche Date: Tue, 7 Apr 2009 14:57:18 -0700 Subject: Add depends_on, use, and setup to abstract up ideas about module inheritance. --- actionpack/lib/action_controller/new_base/hide_actions.rb | 9 +++------ actionpack/lib/action_controller/new_base/layouts.rb | 3 +++ actionpack/lib/action_controller/new_base/renderer.rb | 11 +---------- 3 files changed, 7 insertions(+), 16 deletions(-) (limited to 'actionpack/lib/action_controller/new_base') diff --git a/actionpack/lib/action_controller/new_base/hide_actions.rb b/actionpack/lib/action_controller/new_base/hide_actions.rb index b3777c3c1e..473a8ea72b 100644 --- a/actionpack/lib/action_controller/new_base/hide_actions.rb +++ b/actionpack/lib/action_controller/new_base/hide_actions.rb @@ -1,11 +1,8 @@ module ActionController module HideActions - def self.included(klass) - klass.class_eval do - extend ClassMethods - extlib_inheritable_accessor :hidden_actions - self.hidden_actions ||= Set.new - end + setup do + extlib_inheritable_accessor :hidden_actions + self.hidden_actions ||= Set.new end def action_methods() self.class.action_names end diff --git a/actionpack/lib/action_controller/new_base/layouts.rb b/actionpack/lib/action_controller/new_base/layouts.rb index c0efb669b2..2351472dad 100644 --- a/actionpack/lib/action_controller/new_base/layouts.rb +++ b/actionpack/lib/action_controller/new_base/layouts.rb @@ -1,5 +1,8 @@ module ActionController module Layouts + depends_on ActionController::Renderer + depends_on AbstractController::Layouts + def render_to_string(options) if !options.key?(:text) || options.key?(:layout) options[:_layout] = options.key?(:layout) ? _layout_for_option(options[:layout]) : _default_layout diff --git a/actionpack/lib/action_controller/new_base/renderer.rb b/actionpack/lib/action_controller/new_base/renderer.rb index 24ca9be077..044c15f409 100644 --- a/actionpack/lib/action_controller/new_base/renderer.rb +++ b/actionpack/lib/action_controller/new_base/renderer.rb @@ -1,15 +1,6 @@ module ActionController module Renderer - - # def self.included(klass) - # klass.extend ClassMethods - # end - # - # module ClassMethods - # def prefix - # @prefix ||= name.underscore - # end - # end + depends_on AbstractController::Renderer def initialize(*) self.formats = [:html] -- cgit v1.2.3