種類
- インスタンスメソッド (481)
- 特異メソッド (41)
- モジュール関数 (22)
- クラス (11)
ライブラリ
- ビルトイン (555)
クラス
-
File
:: Stat (440) - IO (11)
- SystemExit (22)
- Thread (49)
モジュール
- Marshal (22)
キーワード
- <=> (11)
-
abort
_ on _ exception= (22) - atime (11)
- blksize (11)
- blockdev? (11)
- blocks (11)
- chardev? (11)
- ctime (11)
- dev (11)
-
dev
_ major (11) -
dev
_ minor (11) - directory? (11)
- dump (22)
- executable? (11)
-
executable
_ real? (11) - file? (11)
- ftype (11)
- gid (11)
- grpowned? (11)
- ino (11)
- mode (11)
- mtime (11)
- nlink (11)
- owned? (11)
- pipe? (11)
- rdev (11)
-
rdev
_ major (11) -
rdev
_ minor (11) - readable? (11)
-
readable
_ real? (11) -
report
_ on _ exception= (16) - setgid? (11)
- setuid? (11)
- size (11)
- size? (11)
- socket? (11)
- status (22)
- sticky? (11)
- symlink? (11)
- sync= (11)
- uid (11)
- writable? (11)
-
writable
_ real? (11) - zero? (11)
検索結果
先頭5件
-
File
:: Stat . new(path) -> File :: Stat (29252.0) -
path に関する File::Stat オブジェクトを生成して返します。 File.stat と同じです。
...path に関する File::Stat オブジェクトを生成して返します。
File.stat と同じです。
@param path ファイルのパスを指定します。
@raise Errno::ENOENT pathに該当するファイルが存在しない場合発生します。
//emlist[][ruby]{
p $:[0]
#=> 例
# "C:....../Program Files/ruby-1.8/lib/ruby/site_ruby/1.8"
p File::Stat.new($:[0])
#=> 例
#<File::Stat dev=0x2, ino=0, mode=040755, nlink=1, uid=0, gid=0, rdev=0x2, size=0, blksize=nil, blocks=nil, atime=Sun Sep 02 14:15:20 +0900 2007, mtime=Tue Apr 24 23:03:44 +0900 2007, ctime=Tue Apr 24 23:03:37 +0900 2007... -
SystemExit
. new(status = 0 , error _ message = "") -> SystemExit (26207.0) -
SystemExit オブジェクトを生成して返します。
...SystemExit オブジェクトを生成して返します。
@param status 終了ステータスを整数で指定します。
@param error_message エラーメッセージを文字列で指定します。
例:
ex = SystemExit.new(1)
p ex.status # => 1... -
File
:: Stat (26018.0) -
ファイルの情報を格納したオブジェクトのクラス。
...る場合はそれと同じ働きをします。ただ、
ファイル名を引数に取るかわりに Stat 自身について判定する点が違います。
//emlist[][ruby]{
p File::Stat.new($0).directory? #=> false
p FileTest.directory?($0) #=> false
//}
1.8 以降では、属性メソッド... -
Thread
# status -> String | false | nil (14124.0) -
生きているスレッドの状態を文字列 "run"、"sleep", "aborting" のいず れかで返します。正常終了したスレッドに対して false、例外によ り終了したスレッドに対して nil を返します。
...ad.new { raise("die now") }
b = Thread.new { Thread.stop }
c = Thread.new { Thread.exit }
d = Thread.new { sleep }
d.kill #=> #<Thread:0x401b3678 aborting>
a.status #=> nil
b.status #=> "sleep"
c.status #=> false
d.status......#=> "aborting"
Thread.current.status #=> "run"
@see Thread#alive?, Thread#stop?... -
SystemExit
# status -> Integer (14112.0) -
例外オブジェクトに保存された終了ステータスを返します。
...します。
終了ステータスは Kernel.#exit や SystemExit.new などで設定されます。
例:
begin
exit 1
rescue SystemExit => err
p err.status # => 1
end
begin
raise SystemExit.new(1, "dummy exit")
rescue SystemExit => err
p err.status # => 1
end... -
File
:: Stat # <=>(o) -> Integer | nil (11066.0) -
ファイルの最終更新時刻を比較します。self が other よりも 新しければ正の数を、等しければ 0 を古ければ負の数を返します。 比較できない場合は nil を返します。
...::Stat のインスタンスを指定します。
//emlist[][ruby]{
require 'tempfile' # for Tempfile
fp1 = Tempfile.open("first")
fp1.print "古い方\n"
sleep(1)
fp2 = Tempfile.open("second")
fp2.print "新しい方\n"
p File::Stat.new(fp1.path) <=> File::Stat.new(fp2.path) #=> -1
p File::Stat.......new(fp2.path) <=> File::Stat.new(fp1.path) #=> 1
p File::Stat.new(fp1.path) <=> fp2.path #=> nil
//}... -
File
:: Stat # size? -> Integer | nil (11030.0) -
サイズが0の時にはnil、それ以外の場合はファイルサイズを返します。
...はnil、それ以外の場合はファイルサイズを返します。
//emlist[][ruby]{
require 'tempfile'
fp = Tempfile.new("temp")
p fp.size #=> 0
p File::Stat.new(fp.path).size? #=> nil
fp.print "not 0 "
fp.close
p FileTest.exist?(fp.path) #=> true
p File::Stat.new(fp.path).size? #=> 6
//}... -
File
:: Stat # symlink? -> false (11028.0) -
シンボリックリンクである時に真を返します。 ただし、File::Statは自動的にシンボリックリンクをたどっていくので 常にfalseを返します。
...す。
ただし、File::Statは自動的にシンボリックリンクをたどっていくので
常にfalseを返します。
//emlist[][ruby]{
require 'fileutils'
outfile = $0 + ".ln"
FileUtils.ln_s($0, outfile)
p File::Stat.new(outfile).symlink? #=> false
p File.lstat(outfile).symlink? #=>......true
p FileTest.symlink?(outfile) #=> true
//}
@see File.lstat... -
File
:: Stat # ftype -> String (11024.0) -
ファイルのタイプを表す文字列を返します。
...directory"
"characterSpecial"
"blockSpecial"
"fifo"
"link"
"socket"
"unknown"
//emlist[例][ruby]{
fs = File::Stat.new($0)
p fs.ftype #=> "file"
p File::Stat.new($:[0]).ftype #=> "directory"
//}
1.8 以降では、属性メソッドがシステムでサポートされていない場... -
File
:: Stat # grpowned? -> bool (11024.0) -
グループIDが実効グループIDと等しい時に真を返します。
...ープIDと等しい時に真を返します。
補助グループIDは考慮されません。
//emlist[][ruby]{
printf "%s %s\n", $:[0], File::Stat.new($:[0]).grpowned?
#例
#=> /usr/local/lib/site_ruby/1.8 false
printf "%s %s\n", $0, File::Stat.new($0).grpowned?
#例
#=> filestat.rb true
//}...