To create a directory I would typically use File.mkdir however class Pathname can be a convenient alternative e.g.

require 'pathname'

pathname = Pathname.new '/home/james/learning/ruby/fun/today.txt'
#=> #

pathname.exist?
#=> false

pathname.basename
#=> #

#=> #

pathname.dirname.mkdir
#=> 0

# observed directory '/home/james/learning/ruby/fun' was just created

Notes:

1) There is no Pathname#mkdir_p meaning parent directories will not be created automatically.

2) If the directory to be created already exists it will create an error
e.g. Errno::EEXIST: File exists - /home/james/learning/ruby/fun

Resources:
- pathname: Ruby Standard Library Documentation [ensta.fr]
- Module: FileUtils [ruby-doc.org]

Read more: http://feeds.dzone.com/~r/dzone/snippets/~3/22zLf6bnb_M/11643