class ActionView::TemplateDetails::Requested

Constants

ANY_HASH

Attributes

formats[R]
formats_idx[R]
handlers[R]
handlers_idx[R]
locale[R]
locale_idx[R]
variants[R]
variants_idx[R]

Public Class Methods

new(locale:, handlers:, formats:, variants:) click to toggle source
# File lib/action_view/template_details.rb, line 11
def initialize(locale:, handlers:, formats:, variants:)
  @locale = locale
  @handlers = handlers
  @formats = formats
  @variants = variants

  @locale_idx   = build_idx_hash(locale)
  @handlers_idx = build_idx_hash(handlers)
  @formats_idx  = build_idx_hash(formats)
  if variants == :any
    @variants_idx = ANY_HASH
  else
    @variants_idx = build_idx_hash(variants)
  end
end

Private Instance Methods

build_idx_hash(arr) click to toggle source
# File lib/action_view/template_details.rb, line 28
def build_idx_hash(arr)
  [*arr, nil].each_with_index.to_h.freeze
end