lib/io_streams/path.rb in iostreams-1.1.0 vs lib/io_streams/path.rb in iostreams-1.1.1
- old
+ new
@@ -1,11 +1,11 @@
module IOStreams
class Path < IOStreams::Stream
attr_accessor :path
def initialize(path)
- raise(ArgumentError, 'Path cannot be nil') if path.nil?
+ raise(ArgumentError, "Path cannot be nil") if path.nil?
raise(ArgumentError, "Path must be a string: #{path.inspect}, class: #{path.class}") unless path.is_a?(String)
@path = path.frozen? ? path : path.dup.freeze
@io_stream = nil
@builder = nil
@@ -28,11 +28,11 @@
def relative?
!absolute?
end
def absolute?
- !!(path.strip =~ /\A\//)
+ !!(path.strip =~ %r{\A/})
end
# By default realpath just returns self.
def realpath
self
@@ -82,15 +82,15 @@
end
# Cleanup an incomplete write to the target "file" if the copy fails.
def copy_from(source, **args)
super(source, **args)
- rescue StandardError => exc
+ rescue StandardError => e
begin
delete
rescue NotImplementedError
end
- raise(exc)
+ raise(e)
end
# Moves the file by copying it to the new path and then deleting the current path.
# Returns [IOStreams::Path] the target path.
#