Fix some Style/StringConcatenation warnings
This commit is contained in:
parent
75e135869e
commit
abca51e4d8
5 changed files with 18 additions and 18 deletions
|
@ -216,7 +216,7 @@ class ApplicationController < ActionController::Base
|
|||
# asserts that the request method is the +method+ given as a parameter
|
||||
# or raises a suitable error. +method+ should be a symbol, e.g: :put or :get.
|
||||
def assert_method(method)
|
||||
ok = request.send((method.to_s.downcase + "?").to_sym)
|
||||
ok = request.send(:"#{method.to_s.downcase}?")
|
||||
raise OSM::APIBadMethodError, method unless ok
|
||||
end
|
||||
|
||||
|
|
|
@ -359,7 +359,7 @@ class UsersController < ApplicationController
|
|||
gravatar_enabled = gravatar_enable(current_user)
|
||||
if current_user.save
|
||||
flash[:notice] = if gravatar_enabled
|
||||
t("users.confirm_email.success") + " " + gravatar_status_message(current_user)
|
||||
"#{t('users.confirm_email.success')} #{gravatar_status_message(current_user)}"
|
||||
else
|
||||
t("users.confirm_email.success")
|
||||
end
|
||||
|
@ -494,7 +494,7 @@ class UsersController < ApplicationController
|
|||
##
|
||||
# omniauth failure callback
|
||||
def auth_failure
|
||||
flash[:error] = t("users.auth_failure." + params[:message])
|
||||
flash[:error] = t("users.auth_failure.#{params[:message]}")
|
||||
redirect_to params[:origin] || login_url
|
||||
end
|
||||
|
||||
|
@ -524,7 +524,7 @@ class UsersController < ApplicationController
|
|||
if referer.nil?
|
||||
params[:origin] = request.path
|
||||
else
|
||||
params[:origin] = request.path + "?referer=" + CGI.escape(referer)
|
||||
params[:origin] = "#{request.path}?referer=#{CGI.escape(referer)}"
|
||||
params[:referer] = referer
|
||||
end
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ module BrowseHelper
|
|||
if object.redacted?
|
||||
""
|
||||
else
|
||||
h(icon_tags(object).map { |k, v| k + "=" + v }.to_sentence)
|
||||
h(icon_tags(object).map { |k, v| "#{k}=#{v}" }.to_sentence)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -13,14 +13,14 @@ require "yaml"
|
|||
require "optparse"
|
||||
|
||||
LOCALE_DIR = File.dirname(__FILE__) + "/../../config/locales/"
|
||||
EN = YAML.load_file(LOCALE_DIR + "en.yml")
|
||||
EN = YAML.load_file("#{LOCALE_DIR}en.yml")
|
||||
|
||||
def iterate(hash, fhash = {}, path = "", outfile = $stdout)
|
||||
hash.each do |key, val|
|
||||
fhash[key] = {} unless fhash.key? key
|
||||
if val.is_a? Hash
|
||||
fhash[key] = {} unless fhash[key].is_a? Hash
|
||||
iterate(val, fhash[key], path + key + ":", outfile)
|
||||
iterate(val, fhash[key], "#{path}#{key}:#{outfile}")
|
||||
else
|
||||
outfile.puts "msgctxt \"#{path}#{key}\""
|
||||
outfile.puts "msgid \"#{val}\""
|
||||
|
@ -31,7 +31,7 @@ end
|
|||
|
||||
def lang2po(lang, outfile = $stdout)
|
||||
puts lang
|
||||
infile = LOCALE_DIR + lang + ".yml"
|
||||
infile = "#{LOCALE_DIR}#{lang}.yml"
|
||||
if File.exist? infile
|
||||
oth = YAML.load_file(infile)
|
||||
oth = oth[lang]
|
||||
|
@ -44,17 +44,17 @@ end
|
|||
opt = ARGV[0]
|
||||
if opt == "--all"
|
||||
# Produce .po files for all langs, and a .pot template
|
||||
PO_DIR = LOCALE_DIR + "po/"
|
||||
Dir.mkdir(PO_DIR) unless File.directory?(PO_DIR)
|
||||
Dir.glob(LOCALE_DIR + "*.yml") do |filename|
|
||||
po_dir = "#{LOCALE_DIR}po/"
|
||||
Dir.mkdir(po_dir) unless File.directory?(po_dir)
|
||||
Dir.glob("#{LOCALE_DIR}/*.yml") do |filename|
|
||||
lang = File.basename(filename, ".yml")
|
||||
unless lang == "en"
|
||||
outfile = File.new(PO_DIR + "#{lang}.po", "w")
|
||||
outfile = File.new("#{po_dir}#{lang}.po", "w")
|
||||
lang2po(lang, outfile)
|
||||
outfile.close
|
||||
end
|
||||
end
|
||||
outfile = File.new(PO_DIR + "rails_port.pot", "w")
|
||||
outfile = File.new("#{po_dir}rails_port.pot", "w")
|
||||
iterate(EN["en"], {}, "", outfile)
|
||||
outfile.close
|
||||
elsif opt
|
||||
|
|
|
@ -16,21 +16,21 @@ class ShortLinksTest < ActionDispatch::IntegrationTest
|
|||
anchor = "map=#{zoom}/#{lat}/#{lon}"
|
||||
|
||||
# test without marker
|
||||
get "/go/" + short_link
|
||||
get "/go/#{short_link}"
|
||||
assert_redirected_to :controller => "site", :action => "index", :anchor => anchor
|
||||
|
||||
# test with marker
|
||||
get "/go/" + short_link + "?m"
|
||||
get "/go/#{short_link}?m"
|
||||
assert_redirected_to :controller => "site", :action => "index", :mlat => lat.to_s, :mlon => lon.to_s, :anchor => anchor
|
||||
|
||||
# test with layers and a marker
|
||||
get "/go/" + short_link + "?m&layers=B000FTF"
|
||||
get "/go/#{short_link}?m&layers=B000FTF"
|
||||
assert_redirected_to :controller => "site", :action => "index", :mlat => lat.to_s, :mlon => lon.to_s, :anchor => "#{anchor}&layers=B000FTF"
|
||||
get "/go/" + short_link + "?layers=B000FTF&m"
|
||||
get "/go/#{short_link}?layers=B000FTF&m"
|
||||
assert_redirected_to :controller => "site", :action => "index", :mlat => lat.to_s, :mlon => lon.to_s, :anchor => "#{anchor}&layers=B000FTF"
|
||||
|
||||
# test with some random query parameters we haven't even implemented yet
|
||||
get "/go/" + short_link + "?foobar=yes"
|
||||
get "/go/#{short_link}?foobar=yes"
|
||||
assert_redirected_to :controller => "site", :action => "index", :foobar => "yes", :anchor => anchor
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue