diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-12-30 12:10:43 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-12-30 12:10:43 +0000 |
commit | d83e02017ec2e04da5e3b6c5921f029f80494980 (patch) | |
tree | 86818f9e664a01fcf7be2e1fcca0d91a043c5fb3 /lib | |
parent | ff9a3de4b3f4cab7ecd183938734ca5bd5cfeaf5 (diff) | |
download | ruby-d83e02017ec2e04da5e3b6c5921f029f80494980.tar.gz |
drb: use \A and \z
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61516 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/drb/drb.rb | 8 | ||||
-rw-r--r-- | lib/drb/ssl.rb | 4 | ||||
-rw-r--r-- | lib/drb/unix.rb | 4 |
3 files changed, 8 insertions, 8 deletions
diff --git a/lib/drb/drb.rb b/lib/drb/drb.rb index 6c516f0359..b30f28cc7c 100644 --- a/lib/drb/drb.rb +++ b/lib/drb/drb.rb @@ -800,7 +800,7 @@ module DRb module_function :uri_option def auto_load(uri) # :nodoc: - if uri =~ /^drb([a-z0-9]+):/ + if /\Adrb([a-z0-9]+):/ =~ uri require("drb/#{$1}") rescue nil end end @@ -816,13 +816,13 @@ module DRb # :stopdoc: private def self.parse_uri(uri) - if uri =~ /^druby:\/\/(.*?):(\d+)(\?(.*))?$/ + if /\Adruby:\/\/(.*?):(\d+)(\?(.*))?\z/ =~ uri host = $1 port = $2.to_i option = $4 [host, port, option] else - raise(DRbBadScheme, uri) unless uri =~ /^druby:/ + raise(DRbBadScheme, uri) unless uri.start_with?('druby:') raise(DRbBadURI, 'can\'t parse uri:' + uri) end end @@ -1172,7 +1172,7 @@ module DRb bt = [] result.backtrace.each do |x| break if /`__send__'$/ =~ x - if /^\(druby:\/\// =~ x + if /\A\(druby:\/\// =~ x bt.push(x) else bt.push(prefix + x) diff --git a/lib/drb/ssl.rb b/lib/drb/ssl.rb index 45fe4f1f74..e2bc247b17 100644 --- a/lib/drb/ssl.rb +++ b/lib/drb/ssl.rb @@ -226,13 +226,13 @@ module DRb # # Raises DRbBadScheme or DRbBadURI if +uri+ is not matching or malformed def self.parse_uri(uri) # :nodoc: - if uri =~ /^drbssl:\/\/(.*?):(\d+)(\?(.*))?$/ + if /\Adrbssl:\/\/(.*?):(\d+)(\?(.*))?\z/ =~ uri host = $1 port = $2.to_i option = $4 [host, port, option] else - raise(DRbBadScheme, uri) unless uri =~ /^drbssl:/ + raise(DRbBadScheme, uri) unless uri.start_with?('drbssl:') raise(DRbBadURI, 'can\'t parse uri:' + uri) end end diff --git a/lib/drb/unix.rb b/lib/drb/unix.rb index adacf6df5b..adc38ff591 100644 --- a/lib/drb/unix.rb +++ b/lib/drb/unix.rb @@ -15,12 +15,12 @@ module DRb class DRbUNIXSocket < DRbTCPSocket # :stopdoc: def self.parse_uri(uri) - if /^drbunix:(.*?)(\?(.*))?$/ =~ uri + if /\Adrbunix:(.*?)(\?(.*))?\z/ =~ uri filename = $1 option = $3 [filename, option] else - raise(DRbBadScheme, uri) unless uri =~ /^drbunix:/ + raise(DRbBadScheme, uri) unless uri.start_with?('drbunix:') raise(DRbBadURI, 'can\'t parse uri:' + uri) end end |