Skip to content

End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

Pathname#join

join(*args)

Joins the given pathnames onto self to create a new Pathname object.

Example
path0 = Pathname.new("/usr")                # Pathname:/usr
path0 = path0.join("bin/ruby")              # Pathname:/usr/bin/ruby
    # is the same as
path1 = Pathname.new("/usr") + "bin/ruby"   # Pathname:/usr/bin/ruby
path0 == path1
    #=> true
See also #grpowned? #lchmod #glob #lchown also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.1