diff options
Diffstat (limited to 'actionmailer/lib/action_mailer/hide_actions.rb')
-rw-r--r-- | actionmailer/lib/action_mailer/hide_actions.rb | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/actionmailer/lib/action_mailer/hide_actions.rb b/actionmailer/lib/action_mailer/hide_actions.rb deleted file mode 100644 index 876da95c3a..0000000000 --- a/actionmailer/lib/action_mailer/hide_actions.rb +++ /dev/null @@ -1,46 +0,0 @@ -require 'active_support/core_ext/class/attribute' - -module ActionMailer - # ActionController::HideActions adds the ability to prevent public methods on a controller - # to be called as actions. - module HideActions - extend ActiveSupport::Concern - - included do - class_attribute :hidden_actions - self.hidden_actions = Set.new.freeze - end - - private - - module ClassMethods - # Sets all of the actions passed in as hidden actions. - # - # ==== Parameters - # *args<#to_s>:: A list of actions - def hide_action(*args) - self.hidden_actions = hidden_actions.dup.merge(args.map(&:to_s)).freeze - end - - # Run block and add all the new action_methods to hidden_actions. - # This is used in inherited method. - def with_hiding_actions - yield - clear_action_methods! - hide_action(*action_methods) - clear_action_methods! - end - - def clear_action_methods! - @action_methods = nil - end - - # Overrides AbstractController::Base#action_methods to remove any methods - # that are listed as hidden methods. - def action_methods - @action_methods ||= super.reject { |name| hidden_actions.include?(name) } - end - end - end -end - |