Class: ActionDispatch::DebugView

Inherits:
ActionView::Base show all
Defined in:
actionpack/lib/action_dispatch/middleware/debug_view.rb

Overview

:nodoc:

Constant Summary collapse

RESCUES_TEMPLATE_PATHS =
[File.expand_path("templates", __dir__)]

Constants included from ActionView::Helpers::UrlHelper

ActionView::Helpers::UrlHelper::BUTTON_TAG_METHOD_VERBS

Constants included from ActionView::Helpers::ContentExfiltrationPreventionHelper

ActionView::Helpers::ContentExfiltrationPreventionHelper::CLOSE_CDATA_COMMENT, ActionView::Helpers::ContentExfiltrationPreventionHelper::CLOSE_FORM_TAG, ActionView::Helpers::ContentExfiltrationPreventionHelper::CLOSE_OPTION_TAG, ActionView::Helpers::ContentExfiltrationPreventionHelper::CLOSE_QUOTES_COMMENT, ActionView::Helpers::ContentExfiltrationPreventionHelper::CONTENT_EXFILTRATION_PREVENTION_MARKUP

Constants included from ActionView::Helpers::TagHelper

ActionView::Helpers::TagHelper::ARIA_PREFIXES, ActionView::Helpers::TagHelper::BOOLEAN_ATTRIBUTES, ActionView::Helpers::TagHelper::DATA_PREFIXES, ActionView::Helpers::TagHelper::PRE_CONTENT_STRINGS, ActionView::Helpers::TagHelper::TAG_TYPES

Constants included from ActionView::Helpers::JavaScriptHelper

ActionView::Helpers::JavaScriptHelper::JS_ESCAPE_MAP

Constants included from ActionView::RecordIdentifier

ActionView::RecordIdentifier::JOIN, ActionView::RecordIdentifier::NEW

Constants included from ActionView::Helpers::DateHelper

ActionView::Helpers::DateHelper::MINUTES_IN_QUARTER_YEAR, ActionView::Helpers::DateHelper::MINUTES_IN_THREE_QUARTERS_YEAR, ActionView::Helpers::DateHelper::MINUTES_IN_YEAR

Constants included from ActionView::Helpers::ControllerHelper

ActionView::Helpers::ControllerHelper::CONTROLLER_DELEGATES

Constants included from ActionView::Helpers::AssetUrlHelper

ActionView::Helpers::AssetUrlHelper::ASSET_EXTENSIONS, ActionView::Helpers::AssetUrlHelper::ASSET_PUBLIC_DIRECTORIES, ActionView::Helpers::AssetUrlHelper::URI_REGEXP

Constants included from ERB::Util

ERB::Util::HTML_ESCAPE, ERB::Util::HTML_ESCAPE_ONCE_REGEXP, ERB::Util::INVALID_TAG_NAME_FOLLOWING_REGEXP, ERB::Util::INVALID_TAG_NAME_START_REGEXP, ERB::Util::JSON_ESCAPE, ERB::Util::JSON_ESCAPE_REGEXP, ERB::Util::SAFE_XML_TAG_NAME_REGEXP, ERB::Util::TAG_NAME_FOLLOWING_CODEPOINTS, ERB::Util::TAG_NAME_REPLACEMENT_CHAR, ERB::Util::TAG_NAME_START_CODEPOINTS

Instance Attribute Summary

Attributes inherited from ActionView::Base

#lookup_context, #view_renderer

Attributes included from ActionView::Helpers::TranslationHelper

#raise_on_missing_translations

Attributes included from ActionView::Context

#output_buffer, #view_flow

Instance Method Summary collapse

Methods inherited from ActionView::Base

#_run, #assign, cache_template_loading, cache_template_loading=, changed?, empty, #in_rendering_context, with_context, with_empty_template_cache, with_view_paths, xss_safe?

Methods included from ActionView::Helpers

eager_load!

Methods included from ActiveSupport::Concern

#append_features, #class_methods, extended, #included, #prepend_features, #prepended

Methods included from ActiveSupport::Autoload

#autoload, #autoload_at, #autoload_under, #eager_autoload, #eager_load!, extended

Methods included from ActionView::Helpers::UrlHelper

#button_to, #current_page?, #link_to, #link_to_if, #link_to_unless, #link_to_unless_current, #mail_to, #phone_to, #sms_to, #url_for

Methods included from ActionView::Helpers::ContentExfiltrationPreventionHelper

#prevent_content_exfiltration

Methods included from ActionView::Helpers::TagHelper

build_tag_values, #cdata_section, #content_tag, #escape_once, #tag, #token_list

Methods included from ActionView::Helpers::OutputSafetyHelper

#raw, #safe_join, #to_sentence

Methods included from ActionView::Helpers::CaptureHelper

#capture, #content_for, #content_for?, #provide, #with_output_buffer

Methods included from ActionView::Helpers::TranslationHelper

#localize, #translate

Methods included from ActionView::Helpers::TextHelper

#concat, #current_cycle, #cycle, #excerpt, #highlight, #pluralize, #reset_cycle, #safe_concat, #simple_format, #truncate, #word_wrap

Methods included from ActionView::Helpers::SanitizeHelper

#sanitize, #sanitize_css, #strip_links, #strip_tags

Methods included from ActionView::Helpers::RenderingHelper

#_layout_for

Methods included from ActionView::Helpers::NumberHelper

#number_to_currency, #number_to_human, #number_to_human_size, #number_to_percentage, #number_to_phone, #number_with_delimiter, #number_with_precision

Methods included from ActionView::Helpers::JavaScriptHelper

#escape_javascript, #javascript_cdata_section, #javascript_tag

Methods included from ActionView::Helpers::FormTagHelper

#button_tag, #check_box_tag, #color_field_tag, #date_field_tag, #datetime_field_tag, #email_field_tag, #field_id, #field_name, #field_set_tag, #file_field_tag, #form_tag, #hidden_field_tag, #image_submit_tag, #label_tag, #month_field_tag, #number_field_tag, #password_field_tag, #radio_button_tag, #range_field_tag, #search_field_tag, #select_tag, #submit_tag, #telephone_field_tag, #text_area_tag, #text_field_tag, #time_field_tag, #url_field_tag, #utf8_enforcer_tag, #week_field_tag

Methods included from ActionView::Helpers::FormOptionsHelper

#collection_check_boxes, #collection_radio_buttons, #collection_select, #grouped_collection_select, #grouped_options_for_select, #option_groups_from_collection_for_select, #options_for_select, #options_from_collection_for_select, #select, #time_zone_options_for_select, #time_zone_select, #weekday_options_for_select, #weekday_select

Methods included from ActionView::Helpers::FormHelper

#_object_for_form_builder, #check_box, #color_field, #date_field, #datetime_field, #email_field, #fields, #fields_for, #file_field, #form_for, #form_with, #hidden_field, #label, #month_field, #number_field, #password_field, #radio_button, #range_field, #rich_text_area, #search_field, #telephone_field, #text_area, #text_field, #time_field, #url_field, #week_field

Methods included from ActionView::RecordIdentifier

#dom_class, #dom_id

Methods included from ActionView::ModelNaming

#convert_to_model, #model_name_from_record_or_class

Methods included from ActionView::Helpers::DebugHelper

#debug

Methods included from ActionView::Helpers::DateHelper

#date_select, #datetime_select, #distance_of_time_in_words, #select_date, #select_datetime, #select_day, #select_hour, #select_minute, #select_month, #select_second, #select_time, #select_year, #time_ago_in_words, #time_select, #time_tag

Methods included from ActionView::Helpers::CsrfHelper

#csrf_meta_tags

Methods included from ActionView::Helpers::CspHelper

#csp_meta_tag

Methods included from ActionView::Helpers::ControllerHelper

#assign_controller, #logger, #respond_to?

Methods included from ActionView::Helpers::CacheHelper

#cache, #cache_fragment_name, #cache_if, #cache_unless, #caching?, #digest_path_from_template, #uncacheable!

Methods included from ActionView::Helpers::AtomFeedHelper

#atom_feed

Methods included from ActionView::Helpers::AssetUrlHelper

#asset_path, #asset_url, #audio_path, #audio_url, #compute_asset_extname, #compute_asset_host, #compute_asset_path, #font_path, #font_url, #image_path, #image_url, #javascript_path, #javascript_url, #stylesheet_path, #stylesheet_url, #video_path, #video_url

Methods included from ActionView::Helpers::AssetTagHelper

#audio_tag, #auto_discovery_link_tag, #favicon_link_tag, #image_tag, #javascript_include_tag, #preload_link_tag, #stylesheet_link_tag, #video_tag

Methods included from ActiveSupport::Benchmarkable

#benchmark

Methods included from ERB::Util

html_escape_once, json_escape, tokenize, xml_name_escape

Methods included from ActionView::Context

#_layout_for, #_prepare_context

Constructor Details

#initialize(assigns) ⇒ DebugView

Returns a new instance of DebugView.



12
13
14
15
16
# File 'actionpack/lib/action_dispatch/middleware/debug_view.rb', line 12

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_containerObject



18
19
20
# File 'actionpack/lib/action_dispatch/middleware/debug_view.rb', line 18

def compiled_method_container
  self.class
end

#debug_hash(object) ⇒ Object



42
43
44
# File 'actionpack/lib/action_dispatch/middleware/debug_view.rb', line 42

def debug_hash(object)
  object.to_hash.sort_by { |k, _| k.to_s }.map { |k, v| "#{k}: #{v.inspect rescue $!.message}" }.join("\n")
end

#debug_headers(headers) ⇒ Object



34
35
36
37
38
39
40
# File 'actionpack/lib/action_dispatch/middleware/debug_view.rb', line 34

def debug_headers(headers)
  if headers.present?
    headers.inspect.gsub(",", ",\n")
  else
    "None"
  end
end

#debug_params(params) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
# File 'actionpack/lib/action_dispatch/middleware/debug_view.rb', line 22

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

Returns:

  • (Boolean)


60
61
62
63
64
# File 'actionpack/lib/action_dispatch/middleware/debug_view.rb', line 60

def params_valid?
  @request.parameters
rescue ActionController::BadRequest
  false
end

#protect_against_forgery?Boolean

Returns:

  • (Boolean)


56
57
58
# File 'actionpack/lib/action_dispatch/middleware/debug_view.rb', line 56

def protect_against_forgery?
  false
end

#renderObject



46
47
48
49
50
51
52
53
54
# File 'actionpack/lib/action_dispatch/middleware/debug_view.rb', line 46

def render(*)
  logger = ActionView::Base.logger

  if logger && logger.respond_to?(:silence)
    logger.silence { super }
  else
    super
  end
end