Skip to content

Commit 43258fe

Browse files
committed
Use %r for regular expressions matching more than 1 '/' character.
1 parent e35db3b commit 43258fe

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

lib/thor/actions.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ def in_root
209209
#
210210
def apply(path, config={})
211211
verbose = config.fetch(:verbose, true)
212-
is_uri = path =~ /^https?\:\/\//
212+
is_uri = path =~ %r{^https?\://}
213213
path = find_in_source_paths(path) unless is_uri
214214

215215
say_status :apply, path, verbose

lib/thor/actions/file_manipulation.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def get(source, *args, &block)
7979
config = args.last.is_a?(Hash) ? args.pop : {}
8080
destination = args.first
8181

82-
source = File.expand_path(find_in_source_paths(source.to_s)) unless source =~ /^https?\:\/\//
82+
source = File.expand_path(find_in_source_paths(source.to_s)) unless source =~ %r{^https?\://}
8383
render = open(source) {|input| input.binmode.read }
8484

8585
destination ||= if block_given?

lib/thor/runner.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def install(name)
7575
as = basename if as.empty?
7676
end
7777

78-
location = if options[:relative] || name =~ /^https?:\/\//
78+
location = if options[:relative] || name =~ %r{^https?://}
7979
name
8080
else
8181
File.expand_path(name)

0 commit comments

Comments
 (0)