diff options
-rw-r--r-- | app/controllers/settings_controller.rb | 2 | ||||
-rw-r--r-- | app/helpers/activities_helper.rb | 4 | ||||
-rw-r--r-- | app/helpers/issue_relations_helper.rb | 2 | ||||
-rw-r--r-- | app/helpers/repositories_helper.rb | 2 | ||||
-rw-r--r-- | app/helpers/search_helper.rb | 2 | ||||
-rw-r--r-- | app/models/query.rb | 2 | ||||
-rw-r--r-- | lib/redmine/helpers/gantt.rb | 2 | ||||
-rw-r--r-- | lib/redmine/i18n.rb | 2 | ||||
-rw-r--r-- | lib/redmine/scm/adapters/mercurial_adapter.rb | 2 | ||||
-rw-r--r-- | lib/redmine/scm/adapters/subversion_adapter.rb | 2 | ||||
-rw-r--r-- | lib/tasks/permissions.rake | 2 |
11 files changed, 12 insertions, 12 deletions
diff --git a/app/controllers/settings_controller.rb b/app/controllers/settings_controller.rb index f4109571f..9985fa6ea 100644 --- a/app/controllers/settings_controller.rb +++ b/app/controllers/settings_controller.rb @@ -46,7 +46,7 @@ class SettingsController < ApplicationController end @options = {} - user_format = User::USER_FORMATS.collect{|key, value| [key, value[:setting_order]]}.sort{|a, b| a[1] <=> b[1]} + user_format = User::USER_FORMATS.collect{|key, value| [key, value[:setting_order]]}.sort_by{|f| f[1]} @options[:user_format] = user_format.collect{|f| [User.current.name(f[0]), f[0].to_s]} @deliveries = ActionMailer::Base.perform_deliveries diff --git a/app/helpers/activities_helper.rb b/app/helpers/activities_helper.rb index 54e5580a2..526709e4a 100644 --- a/app/helpers/activities_helper.rb +++ b/app/helpers/activities_helper.rb @@ -21,9 +21,9 @@ module ActivitiesHelper def sort_activity_events(events) events_by_group = events.group_by(&:event_group) sorted_events = [] - events.sort {|x, y| y.event_datetime <=> x.event_datetime}.each do |event| + events.sort_by(&:event_datetime).reverse_each do |event| if group_events = events_by_group.delete(event.event_group) - group_events.sort {|x, y| y.event_datetime <=> x.event_datetime}.each_with_index do |e, i| + group_events.sort_by(&:event_datetime).reverse.each_with_index do |e, i| sorted_events << [e, i > 0] end end diff --git a/app/helpers/issue_relations_helper.rb b/app/helpers/issue_relations_helper.rb index 6208e5600..a1b3b990a 100644 --- a/app/helpers/issue_relations_helper.rb +++ b/app/helpers/issue_relations_helper.rb @@ -20,6 +20,6 @@ module IssueRelationsHelper def collection_for_relation_type_select values = IssueRelation::TYPES - values.keys.sort{|x,y| values[x][:order] <=> values[y][:order]}.collect{|k| [l(values[k][:name]), k]} + values.keys.sort_by{|k| values[k][:order]}.collect{|k| [l(values[k][:name]), k]} end end diff --git a/app/helpers/repositories_helper.rb b/app/helpers/repositories_helper.rb index 435041b72..59c97cdc5 100644 --- a/app/helpers/repositories_helper.rb +++ b/app/helpers/repositories_helper.rb @@ -269,7 +269,7 @@ module RepositoriesHelper :href => block_given? ? yield(commit.scmid) : commit.scmid } end - heads.sort! { |head1, head2| head1.to_s <=> head2.to_s } + heads.sort_by!(&:to_s) space = nil heads.each do |head| if commits_by_scmid.include? head.scmid diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb index 8788711e7..d7c483048 100644 --- a/app/helpers/search_helper.rb +++ b/app/helpers/search_helper.rb @@ -55,7 +55,7 @@ module SearchHelper def render_results_by_type(results_by_type) links = [] # Sorts types by results count - results_by_type.keys.sort {|a, b| results_by_type[b] <=> results_by_type[a]}.each do |t| + results_by_type.keys.sort_by {|k| results_by_type[k]}.reverse_each do |t| c = results_by_type[t] next if c == 0 text = "#{type_label(t)} (#{c})" diff --git a/app/models/query.rb b/app/models/query.rb index ed11bbffb..e32dda865 100644 --- a/app/models/query.rb +++ b/app/models/query.rb @@ -118,7 +118,7 @@ class QueryCustomFieldColumn < QueryColumn def value_object(object) if custom_field.visible_by?(object.project, User.current) cv = object.custom_values.select {|v| v.custom_field_id == @cf.id} - cv.size > 1 ? cv.sort {|a,b| a.value.to_s <=> b.value.to_s} : cv.first + cv.size > 1 ? cv.sort_by {|e| e.value.to_s} : cv.first else nil end diff --git a/lib/redmine/helpers/gantt.rb b/lib/redmine/helpers/gantt.rb index ca3b70b6f..312a3133a 100644 --- a/lib/redmine/helpers/gantt.rb +++ b/lib/redmine/helpers/gantt.rb @@ -619,7 +619,7 @@ module Redmine end def self.sort_issues!(issues) - issues.sort! {|a, b| sort_issue_logic(a) <=> sort_issue_logic(b)} + issues.sort_by! {|issue| sort_issue_logic(issue)} end def self.sort_issue_logic(issue) diff --git a/lib/redmine/i18n.rb b/lib/redmine/i18n.rb index 43b74bb26..300fb8b06 100644 --- a/lib/redmine/i18n.rb +++ b/lib/redmine/i18n.rb @@ -120,7 +120,7 @@ module Redmine valid_languages. select {|locale| ::I18n.exists?(:general_lang_name, locale)}. map {|lang| [ll(lang.to_s, :general_lang_name), lang.to_s]}. - sort {|x,y| x.first <=> y.first } + sort_by(&:first) else ActionController::Base.cache_store.fetch "i18n/languages_options/#{Redmine::VERSION}" do languages_options :cache => false diff --git a/lib/redmine/scm/adapters/mercurial_adapter.rb b/lib/redmine/scm/adapters/mercurial_adapter.rb index 599c3a42f..a3b672d26 100644 --- a/lib/redmine/scm/adapters/mercurial_adapter.rb +++ b/lib/redmine/scm/adapters/mercurial_adapter.rb @@ -206,7 +206,7 @@ module Redmine :path => with_leading_slash(p), :from_path => (cpmap.member?(p) ? with_leading_slash(cpmap[p]) : nil), :from_revision => (cpmap.member?(p) ? le['node'] : nil)} - end.sort { |a, b| a[:path] <=> b[:path] } + end.sort_by { |e| e[:path] } parents_ary = [] as_ary(le['parents']['parent']).map do |par| parents_ary << par['__content__'] if par['__content__'] != "0000000000000000000000000000000000000000" diff --git a/lib/redmine/scm/adapters/subversion_adapter.rb b/lib/redmine/scm/adapters/subversion_adapter.rb index 318f045a0..11c8c9c60 100644 --- a/lib/redmine/scm/adapters/subversion_adapter.rb +++ b/lib/redmine/scm/adapters/subversion_adapter.rb @@ -168,7 +168,7 @@ module Redmine :from_revision => path['copyfrom-rev'] } end if logentry['paths'] && logentry['paths']['path'] - paths.sort! { |x,y| x[:path] <=> y[:path] } + paths.sort_by! {|e| e[:path]} revisions << Revision.new({:identifier => logentry['revision'], :author => (logentry['author'] ? logentry['author']['__content__'] : ""), diff --git a/lib/tasks/permissions.rake b/lib/tasks/permissions.rake index 02ce1b2a8..3ed53f1f1 100644 --- a/lib/tasks/permissions.rake +++ b/lib/tasks/permissions.rake @@ -2,7 +2,7 @@ namespace :redmine do desc "List all permissions and the actions registered with them" task :permissions => :environment do puts "Permission Name - controller/action pairs" - Redmine::AccessControl.permissions.sort {|a,b| a.name.to_s <=> b.name.to_s }.each do |permission| + Redmine::AccessControl.permissions.sort_by {|p| p.name.to_s}.each do |permission| puts ":#{permission.name} - #{permission.actions.join(', ')}" end end |