Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #14521 from kreynolds/replace-regexp-with-include-…

…or-string

Replace trivial regexp with string or include, twice as fast
  • Loading branch information...
commit 86c53d510cf31b792a7e96a44535e64b3983d17a 2 parents 74d7df1 + e43cd0a
@fxn fxn authored
View
2  actionpack/lib/action_controller/metal/http_authentication.rb
@@ -96,7 +96,7 @@ def authenticate(request, &login_procedure)
end
def user_name_and_password(request)
- decode_credentials(request).split(/:/, 2)
+ decode_credentials(request).split(':', 2)
end
def decode_credentials(request)
View
2  actionpack/lib/action_dispatch/http/mime_type.rb
@@ -174,7 +174,7 @@ def register(string, symbol, mime_type_synonyms = [], extension_synonyms = [], s
end
def parse(accept_header)
- if accept_header !~ /,/
+ if !accept_header.include?(',')
accept_header = accept_header.split(PARAMETER_SEPARATOR_REGEXP).first
parse_trailing_star(accept_header) || [Mime::Type.lookup(accept_header)].compact
else
View
2  activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb
@@ -318,7 +318,7 @@ def limited_update_conditions(where_sql, quoted_table_name, quoted_primary_key)
def sanitize_limit(limit)
if limit.is_a?(Integer) || limit.is_a?(Arel::Nodes::SqlLiteral)
limit
- elsif limit.to_s =~ /,/
+ elsif limit.to_s.include?(',')
Arel.sql limit.to_s.split(',').map{ |i| Integer(i) }.join(',')
else
Integer(limit)
View
2  activerecord/lib/active_record/railties/databases.rake
@@ -186,7 +186,7 @@ db_namespace = namespace :db do
fixtures_dir = File.join [base_dir, ENV['FIXTURES_DIR']].compact
- (ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/) : Dir["#{fixtures_dir}/**/*.yml"].map {|f| f[(fixtures_dir.size + 1)..-5] }).each do |fixture_file|
+ (ENV['FIXTURES'] ? ENV['FIXTURES'].split(',') : Dir["#{fixtures_dir}/**/*.yml"].map {|f| f[(fixtures_dir.size + 1)..-5] }).each do |fixture_file|
ActiveRecord::FixtureSet.create_fixtures(fixtures_dir, fixture_file)
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.