Class: ActionView::TemplateDetails
- Defined in:
- actionview/lib/action_view/template_details.rb
Overview
:nodoc:
Defined Under Namespace
Classes: Requested
Instance Attribute Summary collapse
-
#format ⇒ Object
readonly
Returns the value of attribute format.
-
#handler ⇒ Object
readonly
Returns the value of attribute handler.
-
#locale ⇒ Object
readonly
Returns the value of attribute locale.
-
#variant ⇒ Object
readonly
Returns the value of attribute variant.
Instance Method Summary collapse
- #format_or_default ⇒ Object
- #handler_class ⇒ Object
-
#initialize(locale, handler, format, variant) ⇒ TemplateDetails
constructor
A new instance of TemplateDetails.
- #matches?(requested) ⇒ Boolean
- #sort_key_for(requested) ⇒ Object
Constructor Details
#initialize(locale, handler, format, variant) ⇒ TemplateDetails
Returns a new instance of TemplateDetails.
35 36 37 38 39 40 |
# File 'actionview/lib/action_view/template_details.rb', line 35 def initialize(locale, handler, format, variant) @locale = locale @handler = handler @format = format @variant = variant end |
Instance Attribute Details
#format ⇒ Object (readonly)
Returns the value of attribute format
33 34 35 |
# File 'actionview/lib/action_view/template_details.rb', line 33 def format @format end |
#handler ⇒ Object (readonly)
Returns the value of attribute handler
33 34 35 |
# File 'actionview/lib/action_view/template_details.rb', line 33 def handler @handler end |
#locale ⇒ Object (readonly)
Returns the value of attribute locale
33 34 35 |
# File 'actionview/lib/action_view/template_details.rb', line 33 def locale @locale end |
#variant ⇒ Object (readonly)
Returns the value of attribute variant
33 34 35 |
# File 'actionview/lib/action_view/template_details.rb', line 33 def variant @variant end |
Instance Method Details
#format_or_default ⇒ Object
62 63 64 |
# File 'actionview/lib/action_view/template_details.rb', line 62 def format_or_default format || handler_class.try(:default_format) end |
#handler_class ⇒ Object
58 59 60 |
# File 'actionview/lib/action_view/template_details.rb', line 58 def handler_class Template.handler_for_extension(handler) end |
#matches?(requested) ⇒ Boolean
42 43 44 45 46 47 |
# File 'actionview/lib/action_view/template_details.rb', line 42 def matches?(requested) requested.formats_idx[@format] && requested.locale_idx[@locale] && requested.variants_idx[@variant] && requested.handlers_idx[@handler] end |
#sort_key_for(requested) ⇒ Object
49 50 51 52 53 54 55 56 |
# File 'actionview/lib/action_view/template_details.rb', line 49 def sort_key_for(requested) [ requested.formats_idx[@format], requested.locale_idx[@locale], requested.variants_idx[@variant], requested.handlers_idx[@handler] ] end |