Merge pull request #1076 from marshall-lee/frozen_string_literal
Enable frozen_string_literal feature.
This commit is contained in:
commit
1666dade4f
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# external dependencies
|
# external dependencies
|
||||||
require 'rack'
|
require 'rack'
|
||||||
require 'tilt'
|
require 'tilt'
|
||||||
|
@ -268,7 +270,7 @@ module Sinatra
|
||||||
# Takes Rack routers and reverse proxies into account.
|
# Takes Rack routers and reverse proxies into account.
|
||||||
def uri(addr = nil, absolute = true, add_script_name = true)
|
def uri(addr = nil, absolute = true, add_script_name = true)
|
||||||
return addr if addr =~ /\A[A-z][A-z0-9\+\.\-]*:/
|
return addr if addr =~ /\A[A-z][A-z0-9\+\.\-]*:/
|
||||||
uri = [host = ""]
|
uri = [host = String.new]
|
||||||
if absolute
|
if absolute
|
||||||
host << "http#{'s' if request.secure?}://"
|
host << "http#{'s' if request.secure?}://"
|
||||||
if request.forwarded? or request.port != (request.secure? ? 443 : 80)
|
if request.forwarded? or request.port != (request.secure? ? 443 : 80)
|
||||||
|
@ -342,7 +344,7 @@ module Sinatra
|
||||||
|
|
||||||
# Set the Content-Disposition to "attachment" with the specified filename,
|
# Set the Content-Disposition to "attachment" with the specified filename,
|
||||||
# instructing the user agents to prompt to save.
|
# instructing the user agents to prompt to save.
|
||||||
def attachment(filename = nil, disposition = 'attachment')
|
def attachment(filename = nil, disposition = :attachment)
|
||||||
response['Content-Disposition'] = disposition.to_s
|
response['Content-Disposition'] = disposition.to_s
|
||||||
if filename
|
if filename
|
||||||
params = '; filename="%s"' % File.basename(filename)
|
params = '; filename="%s"' % File.basename(filename)
|
||||||
|
@ -360,7 +362,7 @@ module Sinatra
|
||||||
|
|
||||||
disposition = opts[:disposition]
|
disposition = opts[:disposition]
|
||||||
filename = opts[:filename]
|
filename = opts[:filename]
|
||||||
disposition = 'attachment' if disposition.nil? and filename
|
disposition = :attachment if disposition.nil? and filename
|
||||||
filename = path if filename.nil?
|
filename = path if filename.nil?
|
||||||
attachment(filename, disposition) if disposition
|
attachment(filename, disposition) if disposition
|
||||||
|
|
||||||
|
@ -1299,7 +1301,7 @@ module Sinatra
|
||||||
data.each_line do |line|
|
data.each_line do |line|
|
||||||
lines += 1
|
lines += 1
|
||||||
if line =~ /^@@\s*(.*\S)\s*$/
|
if line =~ /^@@\s*(.*\S)\s*$/
|
||||||
template = force_encoding('', encoding)
|
template = force_encoding(String.new, encoding)
|
||||||
templates[$1.to_sym] = [template, file, lines]
|
templates[$1.to_sym] = [template, file, lines]
|
||||||
elsif template
|
elsif template
|
||||||
template << line
|
template << line
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require 'rack/show_exceptions'
|
require 'rack/show_exceptions'
|
||||||
|
|
||||||
module Sinatra
|
module Sinatra
|
||||||
|
|
Loading…
Reference in New Issue