Fix some rubocop todos

This commit is contained in:
Tom Hughes 2020-08-02 19:38:58 +01:00
parent f881a8c83c
commit 2d3972249c
17 changed files with 48 additions and 70 deletions

View file

@ -12,8 +12,10 @@ class ApplicationController < ActionController::Base
around_action :better_errors_allow_inline, :if => proc { Rails.env.development? }
attr_accessor :current_user
attr_accessor :oauth_token
helper_method :current_user
helper_method :oauth_token
helper_method :preferred_langauges
private
@ -58,7 +60,7 @@ class ApplicationController < ActionController::Base
end
def require_oauth
@oauth = current_user.access_token(Settings.oauth_key) if current_user && Settings.key?(:oauth_key)
@oauth_token = current_user.access_token(Settings.oauth_key) if current_user && Settings.key?(:oauth_key)
end
##

View file

@ -79,11 +79,11 @@ module ApplicationHelper
data[:location] = session[:location] if session[:location]
if @oauth
data[:token] = @oauth.token
data[:token_secret] = @oauth.secret
data[:consumer_key] = @oauth.client_application.key
data[:consumer_secret] = @oauth.client_application.secret
if oauth_token
data[:token] = oauth_token.token
data[:token_secret] = oauth_token.secret
data[:consumer_key] = oauth_token.client_application.key
data[:consumer_secret] = oauth_token.client_application.secret
end
data

View file

@ -1,9 +1,5 @@
module TraceHelper
def link_to_tag(tag)
if @action == "mine"
link_to(tag, :tag => tag, :page => nil)
else
link_to(tag, :tag => tag, :display_name => @display_name, :page => nil)
end
link_to(tag, :tag => tag, :page => nil)
end
end

View file

@ -10,11 +10,11 @@ module GeoRecord
end
def to_s
format("%.7f", self)
format("%<coord>.7f", :coord => self)
end
def as_json(_)
format("%.7f", self).to_f
format("%<coord>.7f", :coord => self).to_f
end
end

View file

@ -1,8 +1,8 @@
attrs = {
"minlat" => format("%.7f", bounds.min_lat),
"minlon" => format("%.7f", bounds.min_lon),
"maxlat" => format("%.7f", bounds.max_lat),
"maxlon" => format("%.7f", bounds.max_lon)
"minlat" => format("%<lat>.7f", :lat => bounds.min_lat),
"minlon" => format("%<lon>.7f", :lon => bounds.min_lon),
"maxlat" => format("%<lat>.7f", :lat => bounds.max_lat),
"maxlon" => format("%<lon>.7f", :lon => bounds.max_lon)
}
xml.bounds(attrs)