diff --git a/app/controllers/api_controller.rb b/app/controllers/api_controller.rb
index 25e1e3b95..eb59a8a8d 100644
--- a/app/controllers/api_controller.rb
+++ b/app/controllers/api_controller.rb
@@ -300,10 +300,9 @@ class ApiController < ApplicationController
# * if authenticated via basic auth all permissions are granted, so the list will contain all permissions.
# * unauthenticated users have no permissions, so the list will be empty.
def permissions
- @permissions = case
- when current_token.present?
+ @permissions = if current_token.present?
ClientApplication.all_permissions.select { |p| current_token.read_attribute(p) }
- when @user
+ elsif @user
ClientApplication.all_permissions
else
[]
diff --git a/app/helpers/note_helper.rb b/app/helpers/note_helper.rb
index 2a1016129..6ebd18345 100644
--- a/app/helpers/note_helper.rb
+++ b/app/helpers/note_helper.rb
@@ -3,14 +3,12 @@ module NoteHelper
if by.nil?
I18n.t("browse.note." + event + "_by_anonymous",
:when => friendly_date(at),
- :exact_time => l(at)
- ).html_safe
+ :exact_time => l(at)).html_safe
else
I18n.t("browse.note." + event + "_by",
:when => friendly_date(at),
:exact_time => l(at),
- :user => note_author(by)
- ).html_safe
+ :user => note_author(by)).html_safe
end
end
diff --git a/lib/bounding_box.rb b/lib/bounding_box.rb
index 5d8ada1c4..9f6c3d9d5 100644
--- a/lib/bounding_box.rb
+++ b/lib/bounding_box.rb
@@ -59,11 +59,13 @@ class BoundingBox
# check the bbox is sane
if min_lon > max_lon
raise OSM::APIBadBoundingBox.new(
- "The minimum longitude must be less than the maximum longitude, but it wasn't")
+ "The minimum longitude must be less than the maximum longitude, but it wasn't"
+ )
end
if min_lat > max_lat
raise OSM::APIBadBoundingBox.new(
- "The minimum latitude must be less than the maximum latitude, but it wasn't")
+ "The minimum latitude must be less than the maximum latitude, but it wasn't"
+ )
end
if min_lon < -LON_LIMIT || min_lat < -LAT_LIMIT || max_lon > +LON_LIMIT || max_lat > +LAT_LIMIT
raise OSM::APIBadBoundingBox.new("The latitudes must be between #{-LAT_LIMIT} and #{LAT_LIMIT}," +
@@ -162,7 +164,8 @@ class BoundingBox
def from_bbox_array(bbox_array)
unless bbox_array
raise OSM::APIBadUserInput.new(
- "The parameter bbox is required, and must be of the form min_lon,min_lat,max_lon,max_lat")
+ "The parameter bbox is required, and must be of the form min_lon,min_lat,max_lon,max_lat"
+ )
end
# Take an array of length 4, create a bounding box with min_lon, min_lat, max_lon and
# max_lat within their respective boundaries.
diff --git a/lib/daemons/gpx_import_ctl b/lib/daemons/gpx_import_ctl
index 43fb48c15..8b893a6b2 100755
--- a/lib/daemons/gpx_import_ctl
+++ b/lib/daemons/gpx_import_ctl
@@ -15,7 +15,9 @@ options = YAML.load(
ERB.new(
IO.read(
File.dirname(__FILE__) + "/../../config/daemons.yml"
- )).result).with_symbols!
+ )
+ ).result
+).with_symbols!
options[:dir_mode] = options[:dir_mode].to_sym
Daemons.run File.dirname(__FILE__) + "/gpx_import.rb", options
diff --git a/test/controllers/amf_controller_test.rb b/test/controllers/amf_controller_test.rb
index d388114dd..09b88e98f 100644
--- a/test/controllers/amf_controller_test.rb
+++ b/test/controllers/amf_controller_test.rb
@@ -308,8 +308,7 @@ class AmfControllerTest < ActionController::TestCase
# try to get version 1
v1 = ways(:way_with_versions_v2)
{ latest.id => "",
- v1.way_id => v1.timestamp.strftime("%d %b %Y, %H:%M:%S")
- }.each do |id, t|
+ v1.way_id => v1.timestamp.strftime("%d %b %Y, %H:%M:%S") }.each do |id, t|
amf_content "getway_old", "/1", [id, t]
post :amf_read
assert_response :success
@@ -329,10 +328,9 @@ class AmfControllerTest < ActionController::TestCase
way_id = current_ways(:way_with_versions).id
{ "foo" => "bar",
way_id => "not a date",
- way_id => "2009-03-25 00:00:00", # <- wrong format
- way_id => "0 Jan 2009 00:00:00", # <- invalid date
- -1 => "1 Jan 2009 00:00:00" # <- invalid ID
- }.each do |id, t|
+ way_id => "2009-03-25 00:00:00", # <- wrong format
+ way_id => "0 Jan 2009 00:00:00", # <- invalid date
+ -1 => "1 Jan 2009 00:00:00" }.each do |id, t| # <- invalid
amf_content "getway_old", "/1", [id, t]
post :amf_read
assert_response :success
@@ -352,8 +350,7 @@ class AmfControllerTest < ActionController::TestCase
# try to get specific version of non-existent way
[[0, ""],
[0, "1 Jan 1970, 00:00:00"],
- [v1.way_id, (v1.timestamp - 10).strftime("%d %b %Y, %H:%M:%S")]
- ].each do |id, t|
+ [v1.way_id, (v1.timestamp - 10).strftime("%d %b %Y, %H:%M:%S")]].each do |id, t|
amf_content "getway_old", "/1", [id, t]
post :amf_read
assert_response :success
@@ -369,8 +366,7 @@ class AmfControllerTest < ActionController::TestCase
def test_getway_old_invisible
v1 = ways(:invisible_way)
# try to get deleted version
- [[v1.way_id, (v1.timestamp + 10).strftime("%d %b %Y, %H:%M:%S")]
- ].each do |id, t|
+ [[v1.way_id, (v1.timestamp + 10).strftime("%d %b %Y, %H:%M:%S")]].each do |id, t|
amf_content "getway_old", "/1", [id, t]
post :amf_read
assert_response :success
diff --git a/test/controllers/changeset_controller_test.rb b/test/controllers/changeset_controller_test.rb
index 4db952ab9..ecccb1f5f 100644
--- a/test/controllers/changeset_controller_test.rb
+++ b/test/controllers/changeset_controller_test.rb
@@ -1181,8 +1181,7 @@ EOF
["",
"",
"",
- ""
- ].each do |diff|
+ ""].each do |diff|
# upload it
content diff
post :upload, :id => changesets(:public_user_first_change).id
@@ -1598,8 +1597,7 @@ EOF
def test_query_invalid
["abracadabra!",
"1,2,3,F",
- ";drop table users;"
- ].each do |bbox|
+ ";drop table users;"].each do |bbox|
get :query, :bbox => bbox
assert_response :bad_request, "'#{bbox}' isn't a bbox"
end
@@ -1608,8 +1606,7 @@ EOF
"00-00-00",
";drop table users;",
",",
- "-,-"
- ].each do |time|
+ "-,-"].each do |time|
get :query, :time => time
assert_response :bad_request, "'#{time}' isn't a valid time range"
end
@@ -1617,8 +1614,7 @@ EOF
["me",
"foobar",
"-1",
- "0"
- ].each do |uid|
+ "0"].each do |uid|
get :query, :user => uid
assert_response :bad_request, "'#{uid}' isn't a valid user ID"
end
diff --git a/test/controllers/relation_controller_test.rb b/test/controllers/relation_controller_test.rb
index 854fc51d0..ab0aca45e 100644
--- a/test/controllers/relation_controller_test.rb
+++ b/test/controllers/relation_controller_test.rb
@@ -607,8 +607,7 @@ class RelationControllerTest < ActionController::TestCase
[current_nodes(:used_node_1),
current_nodes(:used_node_2),
current_ways(:used_way),
- current_ways(:way_with_versions)
- ].each_with_index do |element, _version|
+ current_ways(:way_with_versions)].each_with_index do |element, _version|
bbox = element.bbox.to_unscaled
check_changeset_modify(bbox) do |changeset_id|
relation_xml = Relation.find(relation_id).to_xml
diff --git a/test/controllers/way_controller_test.rb b/test/controllers/way_controller_test.rb
index 84846f923..ccf299455 100644
--- a/test/controllers/way_controller_test.rb
+++ b/test/controllers/way_controller_test.rb
@@ -673,8 +673,7 @@ class WayControllerTest < ActionController::TestCase
# check that the set of IDs match expectations
expected_way_ids = [current_ways(:visible_way).id,
- current_ways(:used_way).id
- ]
+ current_ways(:used_way).id]
found_way_ids = ways_xml.find("//osm/way").collect { |w| w["id"].to_i }
assert_equal expected_way_ids.sort, found_way_ids.sort,
"expected ways for node #{current_nodes(:used_node_1).id} did not match found"
diff --git a/test/models/message_test.rb b/test/models/message_test.rb
index a6ae3ecce..ff9f24da4 100644
--- a/test/models/message_test.rb
+++ b/test/models/message_test.rb
@@ -61,8 +61,7 @@ class MessageTest < ActiveSupport::TestCase
"\xC2\xC2", # 2-byte multibyte identifier, followed by another one
"\x4a\x82", # plain ASCII, followed by multibyte continuation
"\x82\x82", # multibyte continuations without multibyte identifier
- "\xe1\x82\x4a", # three-byte identifier, contination and (incorrectly) plain ASCII
- ]
+ "\xe1\x82\x4a"] # three-byte identifier, contination and (incorrectly) plain ASCII
invalid_sequences.each do |char|
begin
# create a message and save to the database