Tbpgr Blog

Employee Experience Engineer tbpgr(てぃーびー) のブログ

Ruby | File | join

概要

File.join

詳細

指定したリストを元にFile.SEPARATORで連結した文字列を返却する。

サンプル

コード
# encoding: utf-8
require 'tbpgr_utils'

puts_eval 'File.join("dir1", "dir2", "dir3", "file.txt")', binding
puts_eval 'File::SEPARATOR', binding
__END__
下記はTbpgrUtils gemの機能
puts_eval

https://rubygems.org/gems/tbpgr_utils
https://github.com/tbpgr/tbpgr_utils
出力
File.join("dir1", "dir2", "dir3", "file.txt") # => "dir1/dir2/dir3/file.txt"
File::SEPARATOR # => "/"