I’ve recently been trying out the Pathname lib, and one thing I want to do is use mkdir to create some directories.
I looked up the documentation and it says it wraps up mkdir but everytime I try to use it I`m getting this error:
irb(main):006:0> p = Pathname.new('/tmp')
=> #<Pathname:/tmp>
irb(main):007:0> a = p.mkdir("123adam")
TypeError: can't convert String into Integer
from /usr/lib/ruby/1.8/pathname.rb:975:in `mkdir'
from /usr/lib/ruby/1.8/pathname.rb:975:in `mkdir'
from (irb):7
from /usr/lib/ruby/1.8/fileutils.rb:1589
Can anyone explain what I`m doing wrong here.
You need to specify the directory you want to create with Pathname and then call
mkdir.This should work:
The argument you can supply are the permissions for the new directory.