lib/refinements/pathnames.rb in refinements-7.13.0 vs lib/refinements/pathnames.rb in refinements-7.14.0
- old
+ new
@@ -12,11 +12,10 @@
end
end
refine Pathname do
def change_dir &block
- Dir.chdir(self, &block)
- self
+ block_given? ? Dir.chdir(self, &block) : (Dir.chdir self and self)
end
def copy to
destination = to.directory? ? to.join(basename) : to
read.then { |content| destination.write content }