module UserRolesHelper
def role_icons(user)
- UserRole::ALL_ROLES.reduce("".html_safe) { |a, e| a + " " + role_icon(user, e) }
+ UserRole::ALL_ROLES.reduce("".html_safe) do |acc, elem|
+ acc + " " + role_icon(user, elem)
+ end
end
def role_icon(user, role)
# materially change the rest of the relation.
any_relations =
changed_members.collect { |_id, type| type == "relation" }
- .inject(false) { |a, e| a || e }
+ .inject(false) { |acc, elem| acc || elem }
update_members = if tags_changed || any_relations
# add all non-relation bounding boxes to the changeset
def spam_score
changeset_score = changesets.size * 50
trace_score = traces.size * 50
- diary_entry_score = diary_entries.inject(0) { |a, e| a + e.body.spam_score }
- diary_comment_score = diary_comments.inject(0) { |a, e| a + e.body.spam_score }
+ diary_entry_score = diary_entries.inject(0) { |acc, elem| acc + elem.body.spam_score }
+ diary_comment_score = diary_comments.inject(0) { |acc, elem| acc + elem.body.spam_score }
score = description.spam_score / 4.0
score += diary_entries.where("created_at > ?", 1.day.ago).count * 10
-Konacha.configure do |config|
- require "capybara/poltergeist"
- config.spec_dir = "test/javascripts"
- config.driver = :poltergeist
-end if defined?(Konacha)
+if defined?(Konacha)
+ Konacha.configure do |config|
+ require "capybara/poltergeist"
+ config.spec_dir = "test/javascripts"
+ config.driver = :poltergeist
+ end
+end
# only try to expand the bbox if there is a value for every coordinate
# which there will be from the previous line as long as array does not contain a nil
if bbox.complete?
- @min_lon = [-SCALED_LON_LIMIT,
- bbox.min_lon + margin * (min_lon - max_lon)].max if bbox.min_lon < min_lon
- @min_lat = [-SCALED_LAT_LIMIT,
- bbox.min_lat + margin * (min_lat - max_lat)].max if bbox.min_lat < min_lat
- @max_lon = [+SCALED_LON_LIMIT,
- bbox.max_lon + margin * (max_lon - min_lon)].min if bbox.max_lon > max_lon
- @max_lat = [+SCALED_LAT_LIMIT,
- bbox.max_lat + margin * (max_lat - min_lat)].min if bbox.max_lat > max_lat
+ if bbox.min_lon < min_lon
+ @min_lon = [-SCALED_LON_LIMIT,
+ bbox.min_lon + margin * (min_lon - max_lon)].max
+ end
+ if bbox.min_lat < min_lat
+ @min_lat = [-SCALED_LAT_LIMIT,
+ bbox.min_lat + margin * (min_lat - max_lat)].max
+ end
+ if bbox.max_lon > max_lon
+ @max_lon = [+SCALED_LON_LIMIT,
+ bbox.max_lon + margin * (max_lon - min_lon)].min
+ end
+ if bbox.max_lat > max_lat
+ @max_lat = [+SCALED_LAT_LIMIT,
+ bbox.max_lat + margin * (max_lat - min_lat)].min
+ end
end
self
end
valid_options << :actions unless in_action
unknown_option_keys = options.keys - valid_options
- raise ActionController::ActionControllerError,
- "Unknown options: #{unknown_option_keys.join(', ')}" unless
- unknown_option_keys.empty?
+ unless unknown_option_keys.empty?
+ raise ActionController::ActionControllerError,
+ "Unknown options: #{unknown_option_keys.join(', ')}"
+ end
options[:singular_name] ||= ActiveSupport::Inflector.singularize(collection_id.to_s)
options[:class_name] ||= ActiveSupport::Inflector.camelize(options[:singular_name])
def with_model
with_element do |model_name, _model_attributes|
model = MODELS[model_name]
- raise OSM::APIBadUserInput.new("Unexpected element type #{model_name}, " +
- "expected node, way or relation.") if model.nil?
+ if model.nil?
+ raise OSM::APIBadUserInput.new("Unexpected element type #{model_name}, " +
+ "expected node, way or relation.")
+ end
# new in libxml-ruby >= 2, expand returns an element not associated
# with a document. this means that there's no encoding parameter,
# which means basically nothing works.