Unified · Split
| @@ -4,6 +4,7 @@ Bundler.require :app · 3 unmodified lines | ||
| 4 | 4 | class App < Sinatra::Application |
| 5 | 5 | Bundler.require environment |
| 6 | 6 | require 'sinatra/cookies' |
| 7 | + require 'tilt/erubis' | |
| 7 | 8 | |
| 8 | 9 | Rack::Mime::MIME_TYPES['.webapp'] = 'application/x-web-app-manifest+json' |
| 9 | 10 | |
| @@ -94,15 +95,17 @@ class App < Sinatra::Application · 84 unmodified lines | ||
| 94 | 95 | @browser ||= Browser.new ua: request.user_agent |
| 95 | 96 | end |
| 96 | 97 | |
| 98 | + UNSUPPORTED_IE_VERSIONS = %w(6 7 8 9).freeze | |
| 99 | + | |
| 97 | 100 | def unsupported_browser? |
| 98 | − browser.ie? && %w(6 7 8 9).include?(browser.version) | |
| 101 | + browser.ie? && UNSUPPORTED_IE_VERSIONS.include?(browser.version) | |
| 99 | 102 | end |
| 100 | 103 | |
| 101 | 104 | def docs |
| 102 | 105 | @docs ||= begin |
| 103 | 106 | cookie = cookies[:docs] |
| 104 | 107 | |
| 105 | − docs = if cookie.nil? || cookie.empty? | |
| 108 | + if cookie.nil? || cookie.empty? | |
| 106 | 109 | settings.default_docs |
| 107 | 110 | else |
| 108 | 111 | cookie.split('/') |
| @@ -111,11 +114,10 @@ class App < Sinatra::Application · 2 unmodified lines | ||
| 111 | 114 | end |
| 112 | 115 | |
| 113 | 116 | def doc_index_urls |
| 114 | − docs.inject [] do |result, slug| | |
| 117 | + docs.each_with_object [] do |slug, result| | |
| 115 | 118 | if doc = settings.docs[slug] |
| 116 | 119 | result << File.join('', settings.docs_prefix, doc['index_path']) + "?#{doc['mtime']}" |
| 117 | 120 | end |
| 118 | − result | |
| 119 | 121 | end |
| 120 | 122 | end |
| 121 | 123 | |