aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/base/responder.rb
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2009-01-27 18:17:39 -0600
committerJoshua Peek <josh@joshpeek.com>2009-01-27 18:17:39 -0600
commita0f2b1d95d3785de92ae271fd7ea23e91c0cadc6 (patch)
treee125027e317889e6402dac147e03fc112c129aec /actionpack/lib/action_controller/base/responder.rb
parenteb9af20b7cc0e374277cf330bdd404f9daab28ec (diff)
downloadrails-a0f2b1d95d3785de92ae271fd7ea23e91c0cadc6.tar.gz
rails-a0f2b1d95d3785de92ae271fd7ea23e91c0cadc6.tar.bz2
rails-a0f2b1d95d3785de92ae271fd7ea23e91c0cadc6.zip
Reorganize ActionController folder structure
Diffstat (limited to 'actionpack/lib/action_controller/base/responder.rb')
-rw-r--r--actionpack/lib/action_controller/base/responder.rb41
1 files changed, 41 insertions, 0 deletions
diff --git a/actionpack/lib/action_controller/base/responder.rb b/actionpack/lib/action_controller/base/responder.rb
new file mode 100644
index 0000000000..f83abb5a4b
--- /dev/null
+++ b/actionpack/lib/action_controller/base/responder.rb
@@ -0,0 +1,41 @@
+module ActionController
+ module Responder
+ def self.included(klass)
+ klass.extend ClassMethods
+ end
+
+ private
+ def render_for_text(text = nil, append_response = false) #:nodoc:
+ @performed_render = true
+
+ if append_response
+ response.body ||= ''
+ response.body << text.to_s
+ else
+ response.body = case text
+ when Proc then text
+ when nil then " " # Safari doesn't pass the headers of the return if the response is zero length
+ else text.to_s
+ end
+ end
+ end
+
+ def action_methods
+ self.class.action_methods
+ end
+
+ module ClassMethods
+ def action_methods
+ @action_methods ||=
+ # All public instance methods of this class, including ancestors
+ public_instance_methods(true).map { |m| m.to_s }.to_set -
+ # Except for public instance methods of Base and its ancestors
+ Base.public_instance_methods(true).map { |m| m.to_s } +
+ # Be sure to include shadowed public instance methods of this class
+ public_instance_methods(false).map { |m| m.to_s } -
+ # And always exclude explicitly hidden actions
+ hidden_actions
+ end
+ end
+ end
+end \ No newline at end of file