Class: ActionDispatch::DebugView
- Inherits:
-
ActionView::Base
- Object
- ActionView::Base
- ActionDispatch::DebugView
- Defined in:
- lib/action_dispatch/middleware/debug_view.rb
Overview
:nodoc:
Constant Summary collapse
- RESCUES_TEMPLATE_PATHS =
[File.("templates", __dir__)]
Instance Method Summary collapse
- #compiled_method_container ⇒ Object
- #debug_hash(object) ⇒ Object
- #debug_headers(headers) ⇒ Object
- #debug_params(params) ⇒ Object
-
#initialize(assigns) ⇒ DebugView
constructor
A new instance of DebugView.
- #params_valid? ⇒ Boolean
- #protect_against_forgery? ⇒ Boolean
- #render ⇒ Object
Constructor Details
#initialize(assigns) ⇒ DebugView
Returns a new instance of DebugView.
14 15 16 17 18 |
# File 'lib/action_dispatch/middleware/debug_view.rb', line 14 def initialize(assigns) paths = RESCUES_TEMPLATE_PATHS.dup lookup_context = ActionView::LookupContext.new(paths) super(lookup_context, assigns, nil) end |
Instance Method Details
#compiled_method_container ⇒ Object
20 21 22 |
# File 'lib/action_dispatch/middleware/debug_view.rb', line 20 def compiled_method_container self.class end |
#debug_hash(object) ⇒ Object
44 45 46 |
# File 'lib/action_dispatch/middleware/debug_view.rb', line 44 def debug_hash(object) object.to_hash.sort_by { |k, _| k.to_s }.map { |k, v| "#{k}: #{v.inspect rescue $!.}" }.join("\n") end |
#debug_headers(headers) ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/action_dispatch/middleware/debug_view.rb', line 36 def debug_headers(headers) if headers.present? headers.inspect.gsub(",", ",\n") else "None" end end |
#debug_params(params) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/action_dispatch/middleware/debug_view.rb', line 24 def debug_params(params) clean_params = params.clone clean_params.delete("action") clean_params.delete("controller") if clean_params.empty? "None" else PP.pp(clean_params, +"", 200) end end |
#params_valid? ⇒ Boolean
62 63 64 65 66 |
# File 'lib/action_dispatch/middleware/debug_view.rb', line 62 def params_valid? @request.parameters rescue ActionController::BadRequest false end |
#protect_against_forgery? ⇒ Boolean
58 59 60 |
# File 'lib/action_dispatch/middleware/debug_view.rb', line 58 def protect_against_forgery? false end |
#render ⇒ Object
48 49 50 51 52 53 54 55 56 |
# File 'lib/action_dispatch/middleware/debug_view.rb', line 48 def render(*) logger = ActionView::Base.logger if logger && logger.respond_to?(:silence) logger.silence { super } else super end end |