Class: Jpmobile::TemplateDetails

Inherits:
ActionView::TemplateDetails
  • Object
show all
Defined in:
lib/jpmobile/template_details.rb

Defined Under Namespace

Classes: Requested

Instance Method Summary collapse

Constructor Details

#initialize(locale, handler, format, variant, mobile) ⇒ TemplateDetails

Returns a new instance of TemplateDetails.



3
4
5
6
7
# File 'lib/jpmobile/template_details.rb', line 3

def initialize(locale, handler, format, variant, mobile)
  @mobile = mobile

  super(locale, handler, format, variant)
end

Instance Method Details

#matches?(requested) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
12
13
14
15
# File 'lib/jpmobile/template_details.rb', line 9

def matches?(requested)
  requested.formats_idx[@format] &&
    requested.locale_idx[@locale] &&
    requested.variants_idx[@variant] &&
    requested.handlers_idx[@handler] &&
    requested.mobile_idx[@mobile]
end

#sort_key_for(requested) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/jpmobile/template_details.rb', line 17

def sort_key_for(requested)
  [
    requested.formats_idx[@format],
    requested.locale_idx[@locale],
    requested.variants_idx[@variant],
    requested.mobile_idx[@mobile],
    requested.handlers_idx[@handler],
  ]
end