Skip to content

Commit

Permalink
Enable frozen_string_literal feature.
Browse files Browse the repository at this point in the history
  • Loading branch information
marshall-lee committed Feb 1, 2016
1 parent 655de16 commit 56a6141
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/sinatra/base.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# external dependencies
require 'rack'
require 'tilt'
Expand Down Expand Up @@ -268,7 +270,7 @@ def redirect(uri, *args)
# Takes Rack routers and reverse proxies into account.
def uri(addr = nil, absolute = true, add_script_name = true)
return addr if addr =~ /\A[A-z][A-z0-9\+\.\-]*:/
uri = [host = ""]
uri = [host = String.new]
if absolute
host << "http#{'s' if request.secure?}://"
if request.forwarded? or request.port != (request.secure? ? 443 : 80)
Expand Down Expand Up @@ -342,7 +344,7 @@ def content_type(type = nil, params = {})

# Set the Content-Disposition to "attachment" with the specified filename,
# 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
if filename
params = '; filename="%s"' % File.basename(filename)
Expand All @@ -360,8 +362,8 @@ def send_file(path, opts = {})

disposition = opts[:disposition]
filename = opts[:filename]
disposition = 'attachment' if disposition.nil? and filename
filename = path if filename.nil?
disposition = :attachment if disposition.nil? and filename
filename = path if filename.nil?
attachment(filename, disposition) if disposition

last_modified opts[:last_modified] if opts[:last_modified]
Expand Down Expand Up @@ -1299,7 +1301,7 @@ def inline_templates=(file = nil)
data.each_line do |line|
lines += 1
if line =~ /^@@\s*(.*\S)\s*$/
template = force_encoding('', encoding)
template = force_encoding(String.new, encoding)
templates[$1.to_sym] = [template, file, lines]
elsif template
template << line
Expand Down
2 changes: 2 additions & 0 deletions lib/sinatra/show_exceptions.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'rack/show_exceptions'

module Sinatra
Expand Down

0 comments on commit 56a6141

Please sign in to comment.