以下の内容はhttps://tbpgr.hatenablog.com/entry/20140124/1390573864より取得しました。


Ruby | File | split

概要

File.split

詳細

引数にファイルパスを指定することで、ディレクトリ部とファイル部をリストで返却する。

サンプル

コード
# encoding: utf-8

def create_file(filename, contents)
  File.open(filename, 'w:utf-8') {|f|f.print contents}
end

create_file 'hoge.txt', "test"
Dir.mkdir 'tmp' unless Dir.exists? 'tmp'
Dir.chdir 'tmp'
p File.split('../hoge.txt')
出力
["..", "hoge.txt"]



以上の内容はhttps://tbpgr.hatenablog.com/entry/20140124/1390573864より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14