種類
- インスタンスメソッド (353)
- モジュール関数 (286)
- 特異メソッド (219)
クラス
-
ARGF
. class (96) - Binding (7)
- Dir (12)
- Exception (32)
- File (156)
- IO (20)
- Method (12)
- Module (12)
-
ObjectSpace
:: WeakMap (12) - Set (6)
- String (87)
- Thread (24)
- TracePoint (24)
オブジェクト
- ENV (48)
キーワード
- []= (12)
- atime (12)
-
backtrace
_ locations (36) -
caller
_ locations (24) - chomp (12)
- chop (12)
- chown (12)
- chr (12)
-
const
_ source _ location (12) - ctime (24)
- delete (36)
-
delete
_ if (3) -
each
_ char (12) -
each
_ codepoint (24) - empty? (9)
- encoding (12)
-
executable
_ real? (12) - exists? (9)
- fdatasync (12)
- gets (36)
- grpowned? (12)
- gsub (36)
- hash (12)
- identical? (12)
-
inplace
_ mode (12) - inspect (18)
-
internal
_ encoding (12) -
latest
_ gc _ info (24) - lchmod (12)
- lchown (12)
- length (12)
- mtime (12)
- new (39)
- open (24)
- owned? (12)
- path (12)
- read (12)
- readable? (12)
- readlink (12)
- reject (24)
- reject! (3)
-
set
_ backtrace (12) - setgid? (12)
- setuid? (12)
- size (12)
- size? (12)
- socket? (12)
-
source
_ location (7) - sticky? (12)
- symlink? (12)
-
to
_ s (6) - unlink (12)
- warn (4)
- writable? (12)
- write (8)
- zero? (12)
検索結果
先頭5件
-
Kernel
. # test(cmd , file) -> bool | Time | Integer | nil (24338.0) -
単体のファイルでファイルテストを行います。
...コマンドとみなします。
@param file テストするファイルのパスを表す文字列か IO オブジェクトを指定します。
@return 下表に特に明記していないものは、真偽値を返します。
以下は cmd として指定できる文字リテラルとその意......: ?z
ファイルサイズが 0 である
: ?s
ファイルサイズが 0 でない (ファイルサイズを返す、0 ならば nil) -> Integer|nil
: ?f
ファイルはプレーンファイルである
: ?d
ファイルはディレクトリである
: ?l
ファイルはシン......る
: ?u
ファイルに setuid ビットがセットされている
: ?g
ファイルに setgid ビットがセットされている
: ?k
ファイルに sticky ビットがセットされている
: ?M
ファイルの最終更新時刻を返す -> Time
: ?A
ファイルの最... -
Kernel
. # test(cmd , file1 , file2) -> bool (24233.0) -
2ファイル間のファイルテストを行います。
...ェクトを指定します。
@param file2 テストするファイルのパスを表す文字列か IO オブジェクトを指定します。
@return 真偽値を返します。
以下は cmd として指定できる文字リテラルとその意味です。
: ?=
ファイル1とファイ......イル1とファイル2が同一のファイルである
//emlist[例][ruby]{
IO.write("testfile1", "test1")
IO.write("testfile2", "test2")
%w(= < > -).each do |e|
result = test(e, "testfile1", "testfile2")
puts "#{e}: #{result}"
end
//}
# => =: true
# => <: false
# => >: false
# => -: false... -
GC
. latest _ gc _ info(key) -> object (12208.0) -
最新のGCの情報を返します。
...最新のGCの情報を返します。
@param result_hash 戻り値のためのハッシュを指定します。省略した場合は新
しくハッシュを作成します。result_hash の内容は上書き
されます。
@param key 得られる情報か......定します。
//emlist[例][ruby]{
latest = GC.latest_gc_info
latest # => {:major_by=>nil, :gc_by=>:newobj, :have_finalizer=>false, :immediate_sweep=>false, :state=>:sweeping}
stat = GC.stat
merged = GC.latest_gc_info(stat)
merged == latest.merge(stat) # => true
GC.latest_gc_info(:gc_by) # =... -
GC
. latest _ gc _ info(result _ hash = {}) -> Hash (12208.0) -
最新のGCの情報を返します。
...最新のGCの情報を返します。
@param result_hash 戻り値のためのハッシュを指定します。省略した場合は新
しくハッシュを作成します。result_hash の内容は上書き
されます。
@param key 得られる情報か......定します。
//emlist[例][ruby]{
latest = GC.latest_gc_info
latest # => {:major_by=>nil, :gc_by=>:newobj, :have_finalizer=>false, :immediate_sweep=>false, :state=>:sweeping}
stat = GC.stat
merged = GC.latest_gc_info(stat)
merged == latest.merge(stat) # => true
GC.latest_gc_info(:gc_by) # =... -
Exception
# backtrace _ locations -> [Thread :: Backtrace :: Location] (9238.0) -
バックトレース情報を返します。Exception#backtraceに似ていますが、 Thread::Backtrace::Location の配列を返す点が異なります。
...ption#backtraceに似ていますが、
Thread::Backtrace::Location の配列を返す点が異なります。
現状では Exception#set_backtrace によって戻り値が変化する事はあり
ません。
//emlist[例: test.rb][ruby]{
require "date"
def check_long_month(month)
return if Dat......month, -1).day == 31
raise "#{month} is not long month"
end
def get_exception
return begin
yield
rescue => e
e
end
end
e = get_exception { check_long_month(2) }
p e.backtrace_locations
# => ["test.rb:4:in `check_long_month'", "test.rb:15:in `block in <main>'", "test.rb:9:in `get_ex......ception'", "test.rb:15:in `<main>'"]
//}
@see Exception#backtrace... -
FileTest
. # sticky?(file) -> bool (9120.0) -
ファイルの sticky ビット(chmod(2) 参照)が 立っている時に真を返します。そうでない場合、ファイルが存在しない場合、あるいはシステムコールに失敗した場合などには false を返します。
...ファイルの sticky ビット(chmod(2) 参照)が
立っている時に真を返します。そうでない場合、ファイルが存在しない場合、あるいはシステムコールに失敗した場合などには false を返します。
@param file ファイル名を表す文字列か......IO オブジェクトを指定します。
//emlist[例][ruby]{
require 'fileutils'
IO.write("testfile", "")
FileUtils.chmod("o+t", "testfile")
FileTest.sticky?("testfile") # => true
FileUtils.chmod("o-t", "testfile")
FileTest.sticky?("testfile") # => false
//}... -
FileTest
. # exists?(file) -> bool (9118.0) -
このメソッドは Ruby 2.1 から deprecated です。FileTest.#exist? を使用してください。
...このメソッドは Ruby 2.1 から deprecated です。FileTest.#exist? を使用してください。... -
FileTest
. # identical?(file1 , file2) -> bool (9114.0) -
file1 と file2 が同じファイルを指している時に真を返します。 そうでない場合、ファイルが存在しない場合、あるいはシステムコールに失敗した場合などには false を返します。
...
ruby 1.8.3 以前ではKernel.#test(?-, file1, file2)を使ってください。
open("a", "w") {}
p File.identical?("a", "a") #=> true
p File.identical?("a", "./a") #=> true
File.link("a", "b")
p File.identical?("a", "b") #=> true
File.symlink("a", "c")
p File.identica......l?("a", "c") #=> true
open("d", "w") {}
p File.identical?("a", "d") #=> false
@param file1 ファイル名を表す文字列か IO オブジェクトを指定します。
@param file2 ファイル名を表す文字列か IO オブジェクトを指定します。
@raise IOError 指... -
FileTest
. # socket?(file) -> bool (9114.0) -
ファイルがソケットである時に真を返します。そうでない場合、ファイルが存在しない場合、あるいはシステムコールに失敗した場合などには false を返します。
...が既に close されていた場合に発生します。
//emlist[例][ruby]{
require "socket"
IO.write("testfile", "test")
p FileTest.socket?("testfile") # => false
Socket.unix_server_socket('testsock') { p FileTest.socket?('testsock') } # => true
//}...