ライブラリ
- ビルトイン (546)
- csv (33)
-
net
/ ftp (18) -
net
/ http (88) -
net
/ pop (22) - openssl (77)
- pathname (44)
- rake (11)
-
rake
/ loaders / makefile (11) -
rubygems
/ indexer (11) -
rubygems
/ remote _ fetcher (11) - shell (12)
-
shell
/ command-processor (12) -
shell
/ filter (24) - tempfile (33)
- zlib (176)
クラス
- CSV (33)
- Dir (21)
- File (110)
-
File
:: Stat (11) -
Gem
:: Indexer (11) -
Gem
:: RemoteFetcher (11) - IO (393)
-
Net
:: FTP (18) -
Net
:: HTTP (44) -
Net
:: HTTPGenericRequest (22) -
Net
:: HTTPResponse (22) -
Net
:: POP3 (22) -
OpenSSL
:: Config (11) -
OpenSSL
:: SSL :: SSLContext (44) -
OpenSSL
:: X509 :: ExtensionFactory (11) -
OpenSSL
:: X509 :: Store (11) - Pathname (44)
-
Rake
:: MakefileLoader (11) - Shell (12)
-
Shell
:: CommandProcessor (12) -
Shell
:: Filter (24) - Tempfile (33)
-
Zlib
:: GzipReader (22) -
Zlib
:: GzipWriter (154)
モジュール
- Enumerable (11)
- Kernel (11)
キーワード
- << (22)
- <=> (11)
- > (6)
- >> (6)
-
add
_ file (11) -
add
_ row (11) - advise (11)
- atime (11)
-
body
_ stream (11) -
body
_ stream= (11) -
ca
_ file (11) -
ca
_ file= (11) -
cert
_ store= (11) - chown (11)
- chunk (11)
- clone (11)
- close (33)
- close! (11)
-
close
_ on _ exec= (11) - comment= (11)
- config= (11)
- ctime (11)
-
delete
_ all (22) - dup (11)
- each (11)
-
each
_ byte (22) -
each
_ codepoint (22) -
external
_ encoding (11) - fcntl (11)
- fdatasync (11)
- file (11)
- fileno (10)
- finish (11)
- flock (11)
- flush (22)
- get (22)
- gzip (11)
-
internal
_ encoding (11) - load (11)
- lstat (11)
- mlsd (18)
- mtime (11)
- mtime= (11)
- open (51)
-
open
_ uri _ or _ path (11) -
orig
_ name= (11) - out (18)
- path (11)
- pos (22)
- pos= (11)
- post (22)
- pread (7)
- print (11)
- printf (11)
- putc (11)
- puts (22)
- pwrite (7)
- read (22)
-
read
_ body (22) - readbyte (11)
- readchar (11)
- readline (11)
- readlines (33)
- reopen (33)
-
set
_ encoding (33) -
set
_ encoding _ by _ bom (5) -
set
_ params (11) - size (11)
- stat (11)
- sync (11)
- sysread (11)
- sysseek (11)
- syswrite (11)
- tell (22)
-
to
_ path (22) -
to
_ s (11) - truncate (11)
- write (22)
検索結果
先頭5件
-
File
# lstat -> File :: Stat (21154.0) -
ファイルの状態を含む File::Stat オブジェクトを生成して返します。 シンボリックリンクに関してリンクそのものの情報を返します。 lstat(2) を実装していないシステムでは、IO#statと同じです。
...ファイルの状態を含む File::Stat オブジェクトを生成して返します。
シンボリックリンクに関してリンクそのものの情報を返します。
lstat(2) を実装していないシステムでは、IO#statと同じです。
@raise Errno::EXXX 失敗した場合......ose されている場合に発生します。
//emlist[例][ruby]{
# testlink は testfile のシンボリックリンク
File.open("testlink") do |f|
p f.lstat == File.stat("testfile") # => false
p f.stat == File.stat("testfile") # => true
end
//}
@see IO#stat, File.stat, File.lstat... -
File
# flock(operation) -> 0 | false (21145.0) -
ファイルをロックします。
...をロックします。
ロックを取得するまでブロックされます。
ロックの取得に成功した場合は 0 を返します。
File::LOCK_NB (ノンブロッキング) を指定すると、本来ならブロックされる場合に
ブロックされずに false を返すよう......eration に有効な定数は以下の通りです。定数は File::Constants で定義されていますが、
File クラスの親クラスの IO が File::Constants をインクルードしているので、
これらの定数は File::LOCK_SH などとして参照可能です。
: LOCK_SH
共......ブロックモード。
File::LOCK_SH | File::LOCK_NB のように他の指定と or することで指
定します。この指定がない場合、ブロックされる条件での flock
の呼び出しはロックが解除されるまでブロックされます。
File::LOCK_NB の指定が... -
Tempfile
# open -> self (21108.0) -
クローズしたテンポラリファイルを再オープンします。 "r+" でオープンされるので、クローズ前の内容を再度読む ことができます。
...ァイルを再オープンします。
"r+" でオープンされるので、クローズ前の内容を再度読む
ことができます。
require "tempfile"
tf = Tempfile.new("foo")
tf.print("foobar,hoge\n")
tf.print("bar,ugo\n")
tf.close
tf.open
p tf.gets # => "foobar,hoge\n"... -
File
# path -> String (21061.0) -
オープン時に使用したパスを文字列で返します。
...or TMPFILE File::Constants::TMPFILEオプション付きで作成されている場合に発生します。
//emlist[例][ruby]{
File.open("testfile") {|f| f.path } #=> "testfile"
File.open("/tmp/../tmp/xxx", "w") {|f| f.path } #=> "/tmp/../tmp/xxx"
File.open("/tmp......", File::RDWR | File::TMPFILE){|f| f.path } # IOError: File is unnamed (TMPFILE?)
//}... -
File
# to _ path -> String (21061.0) -
オープン時に使用したパスを文字列で返します。
...or TMPFILE File::Constants::TMPFILEオプション付きで作成されている場合に発生します。
//emlist[例][ruby]{
File.open("testfile") {|f| f.path } #=> "testfile"
File.open("/tmp/../tmp/xxx", "w") {|f| f.path } #=> "/tmp/../tmp/xxx"
File.open("/tmp......", File::RDWR | File::TMPFILE){|f| f.path } # IOError: File is unnamed (TMPFILE?)
//}... -
File
# path -> String (21055.0) -
オープン時に使用したパスを文字列で返します。
...、
File::Constants::TMPFILEオプション付きで作成されていたりする場合です。
//emlist[例][ruby]{
File.open("testfile") {|f| f.path } #=> "testfile"
File.open("/tmp/../tmp/xxx", "w") {|f| f.path } #=> "/tmp/../tmp/xxx"
File.open("/tmp", File::R......DWR | File::TMPFILE){|f| f.path } #=> "/tmp"
//}... -
File
# to _ path -> String (21055.0) -
オープン時に使用したパスを文字列で返します。
...、
File::Constants::TMPFILEオプション付きで作成されていたりする場合です。
//emlist[例][ruby]{
File.open("testfile") {|f| f.path } #=> "testfile"
File.open("/tmp/../tmp/xxx", "w") {|f| f.path } #=> "/tmp/../tmp/xxx"
File.open("/tmp", File::R......DWR | File::TMPFILE){|f| f.path } #=> "/tmp"
//}... -
File
# atime -> Time (21037.0) -
最終アクセス時刻を Time オブジェクトとして返します。
...に発生します。
@raise Errno::EXXX ファイルの時刻の取得に失敗した場合に発生します。
//emlist[例:][ruby]{
IO.write("testfile", "test")
File.open("testfile") { |f| f.atime } # => 2017-12-21 22:58:17 +0900
//}
@see File#lstat, File#ctime, File#mtime, File#birthtime... -
File
# ctime -> Time (21037.0) -
状態が最後に変更された時刻を Time オブジェクトとして返します。状態の変更とは chmod などによるものです。
...に発生します。
@raise Errno::EXXX ファイルの時刻の取得に失敗した場合に発生します。
//emlist[例:][ruby]{
IO.write("testfile", "test")
File.open("testfile") { |f| f.ctime } # => 2017-12-21 22:58:17 +0900
//}
@see File#lstat, File#atime, File#mtime, File#birthtime... -
File
# mtime -> Time (21037.0) -
最終更新時刻を Time オブジェクトとして返します。
...に発生します。
@raise Errno::EXXX ファイルの時刻の取得に失敗した場合に発生します。
//emlist[例:][ruby]{
IO.write("testfile", "test")
File.open("testfile") { |f| f.mtime } # => 2017-12-21 22:58:17 +0900
//}
@see File#lstat, File#atime, File#ctime, File#birthtime... -
File
# atime -> Time (21031.0) -
最終アクセス時刻を Time オブジェクトとして返します。
...れている場合に発生します。
@raise Errno::EXXX ファイルの時刻の取得に失敗した場合に発生します。
//emlist[例:][ruby]{
IO.write("testfile", "test")
File.open("testfile") { |f| f.atime } # => 2017-12-21 22:58:17 +0900
//}
@see File#lstat, File#ctime, File#mtime... -
File
# chown(owner , group) -> 0 (21031.0) -
ファイルのオーナーとグループを変更します。
...ます。
@raise Errno::EXXX 変更に失敗した場合に発生します。
//emlist[例][ruby]{
File.open("testfile") { |f| f.chown(502, 1000) } # => 0
File.stat("testfile").uid # => 502
File.stat("testfile").gid # => 1000
//}
@see File.chown... -
File
# ctime -> Time (21031.0) -
状態が最後に変更された時刻を Time オブジェクトとして返します。状態の変更とは chmod などによるものです。
...れている場合に発生します。
@raise Errno::EXXX ファイルの時刻の取得に失敗した場合に発生します。
//emlist[例:][ruby]{
IO.write("testfile", "test")
File.open("testfile") { |f| f.ctime } # => 2017-12-21 22:58:17 +0900
//}
@see File#lstat, File#atime, File#mtime... -
File
# mtime -> Time (21031.0) -
最終更新時刻を Time オブジェクトとして返します。
...ている場合に発生します。
@raise Errno::EXXX ファイルの時刻の取得に失敗した場合に発生します。
//emlist[例:][ruby]{
IO.write("testfile", "test")
File.open("testfile") { |f| f.mtime } # => 2017-12-21 22:58:17 +0900
//}
@see File#lstat, File#atime, File#ctime... -
File
# size -> Integer (21019.0) -
ファイルのサイズを返します。
...ファイルのサイズを返します。
//emlist[例][ruby]{
File.open("/dev/null") do |f|
f.size #=> 0
end
//}
@raise IOError 自身が close されている場合に発生します。
@raise Errno::EXXX 失敗した場合に発生します。
@see File#lstat...