Patch #29363 ยป replace-gsub-with-tr.patch
app/controllers/sys_controller.rb | ||
---|---|---|
38 | 38 |
repository.safe_attributes = params[:repository] |
39 | 39 |
repository.project = project |
40 | 40 |
if repository.save |
41 |
render :json => {repository.class.name.underscore.gsub('/', '-') => {:id => repository.id, :url => repository.url}}, :status => 201
|
|
41 |
render :json => {repository.class.name.underscore.tr('/', '-') => {:id => repository.id, :url => repository.url}}, :status => 201
|
|
42 | 42 |
else |
43 | 43 |
head 422 |
44 | 44 |
end |
app/helpers/application_helper.rb | ||
---|---|---|
512 | 512 |
end |
513 | 513 | |
514 | 514 |
def anchor(text) |
515 |
text.to_s.gsub(' ', '_')
|
|
515 |
text.to_s.tr(' ', '_')
|
|
516 | 516 |
end |
517 | 517 | |
518 | 518 |
def html_hours(text) |
app/models/mailer.rb | ||
---|---|---|
447 | 447 |
'X-Auto-Response-Suppress' => 'All', |
448 | 448 |
'Auto-Submitted' => 'auto-generated', |
449 | 449 |
'From' => Setting.mail_from, |
450 |
'List-Id' => "<#{Setting.mail_from.to_s.gsub('@', '.')}>"
|
|
450 |
'List-Id' => "<#{Setting.mail_from.to_s.tr('@', '.')}>"
|
|
451 | 451 | |
452 | 452 |
# Replaces users with their email addresses |
453 | 453 |
[:to, :cc, :bcc].each do |key| |
app/models/query.rb | ||
---|---|---|
880 | 880 |
filters_clauses << sql_for_custom_field(field, operator, v, $1) |
881 | 881 |
elsif field =~ /^cf_(\d+)\.(.+)$/ |
882 | 882 |
filters_clauses << sql_for_custom_field_attribute(field, operator, v, $1, $2) |
883 |
elsif respond_to?(method = "sql_for_#{field.gsub('.','_')}_field")
|
|
883 |
elsif respond_to?(method = "sql_for_#{field.tr('.','_')}_field")
|
|
884 | 884 |
# specific statement |
885 | 885 |
filters_clauses << send(method, field, operator, v) |
886 | 886 |
else |
config/initializers/10-patches.rb | ||
---|---|---|
6 | 6 |
# Translate attribute names for validation errors display |
7 | 7 |
def self.human_attribute_name(attr, options = {}) |
8 | 8 |
prepared_attr = attr.to_s.sub(/_id$/, '').sub(/^.+\./, '') |
9 |
class_prefix = name.underscore.gsub('/', '_')
|
|
9 |
class_prefix = name.underscore.tr('/', '_')
|
|
10 | 10 | |
11 | 11 |
redmine_default = [ |
12 | 12 |
:"field_#{class_prefix}_#{prepared_attr}", |
lib/redmine/mime_type.rb | ||
---|---|---|
77 | 77 |
# the mime type of name |
78 | 78 |
def self.css_class_of(name) |
79 | 79 |
mime = of(name) |
80 |
mime && mime.gsub('/', '-')
|
|
80 |
mime && mime.tr('/', '-')
|
|
81 | 81 |
end |
82 | 82 | |
83 | 83 |
def self.main_mimetype_of(name) |
lib/redmine/scm/adapters/bazaar_adapter.rb | ||
---|---|---|
94 | 94 |
cmd_args << "-r#{identifier.to_i}" |
95 | 95 |
cmd_args << bzr_target(path) |
96 | 96 |
scm_cmd(*cmd_args) do |io| |
97 |
prefix_utf8 = "#{url}/#{path}".gsub('\\', '/')
|
|
97 |
prefix_utf8 = "#{url}/#{path}".tr('\\', '/')
|
|
98 | 98 |
logger.debug "PREFIX: #{prefix_utf8}" |
99 | 99 |
prefix = scm_iconv(@path_encoding, 'UTF-8', prefix_utf8) |
100 | 100 |
prefix.force_encoding('ASCII-8BIT') |