instance method Pathname#each_filename

each_filename {|v| ... } -> nil[permalink][rdoc][edit]

self のパス名要素毎にブロックを実行します。

require 'pathname'

Pathname.new("/foo/../bar").each_filename {|v| p v}

# => "foo"
     ".."
     "bar"