Open josb opened 5 months ago
I don't understand why you don't use Pathname.new(Dir.home)
. What's the problem that?
It works, but is more verbose and I expected Pathname.home
to work in the first place (POLA).
It'd be cool to have it aliased to ~
.
class Pathname
class << self
def home(user_name = nil)
Pathname(Dir.home(user_name))
end
alias ~ home
end
end
p Pathname.~ #=> #<Pathname:/Users/knu>
p Pathname.~('root') #=> #<Pathname:/var/root>
Please consider adding
Pathname.home
for symmetry withDir.home
but returning aPathname
instead of aString
, and to avoid having to usePathname.new(Dir.home)
.