123456789_123456789_123456789_123456789_123456789_

Class: ActionView::TemplateDetails

Do not use. This class is for internal use only.
Relationships & Source Files
Namespace Children
Classes:
Inherits: Object
Defined in: actionview/lib/action_view/template_details.rb

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(locale, handler, format, variant) ⇒ TemplateDetails

[ GitHub ]

  
# 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 (readonly)

[ GitHub ]

  
# File 'actionview/lib/action_view/template_details.rb', line 33

attr_reader :locale, :handler, :format, :variant

#handler (readonly)

[ GitHub ]

  
# File 'actionview/lib/action_view/template_details.rb', line 33

attr_reader :locale, :handler, :format, :variant

#locale (readonly)

[ GitHub ]

  
# File 'actionview/lib/action_view/template_details.rb', line 33

attr_reader :locale, :handler, :format, :variant

#variant (readonly)

[ GitHub ]

  
# File 'actionview/lib/action_view/template_details.rb', line 33

attr_reader :locale, :handler, :format, :variant

Instance Method Details

#format_or_default

[ GitHub ]

  
# File 'actionview/lib/action_view/template_details.rb', line 62

def format_or_default
  format || handler_class.try(:default_format)
end

#handler_class

[ GitHub ]

  
# File 'actionview/lib/action_view/template_details.rb', line 58

def handler_class
  Template.handler_for_extension(handler)
end

#matches?(requested) ⇒ Boolean

[ GitHub ]

  
# 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)

[ GitHub ]

  
# 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