るりまサーチ

最速Rubyリファレンスマニュアル検索!
985件ヒット [1-100件を表示] (0.101秒)
トップページ > クエリ:_builtin[x] > クエリ:I[x] > クエリ:test[x]

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

ライブラリ

クラス

モジュール

オブジェクト

キーワード

検索結果

<< 1 2 3 ... > >>

Kernel.#test(cmd, file) -> bool | Time | Integer | nil (26329.0)

単体のファイルでファイルテストを行います。

...
です。文字列の場合はその先頭の文字だけをコマンドとみなします。
@param file テストするファイルのパスを表す文字列か IO オブジェクトを指定します。
@return 下表に特に明記していないものは、真偽値を返しま...
...イルを実効 uid で読むことができる
: ?w
ファイルに実効 uid で書くことができる
: ?x
ファイルを実効 uid で実行できる
: ?o
ファイルの所有者が実効 uid である
: ?G
ファイルのグループ所有者が実効 gid である
: ?R...
...ファイルを実 uid で読むことができる
: ?W
ファイルに実 uid で書くことができる
: ?X
ファイルを実 uid で実行できる
: ?O
ファイルの所有者が実 uid である
: ?e
ファイルが存在する
: ?z
ファイルサイズが 0 である
:...

Kernel.#test(cmd, file1, file2) -> bool (26324.0)

2ファイル間のファイルテストを行います。

...の文字だけをコマンドとみなします。
@param file1 テストするファイルのパスを表す文字列か IO オブジェクトを指定します。
@param file2 テストするファイルのパスを表す文字列か IO オブジェクトを指定します。
@return 真偽値を...
...: ?-
ファイル1とファイル2が同一のファイルである

//emlist[例][ruby]{
I
O.write("testfile1", "test1")
I
O.write("testfile2", "test2")
%w(= < > -).each do |e|
result = test(e, "testfile1", "testfile2")
puts "#{e}: #{result}"
end
//}

# => =: true
# => <: false
# => >: false...

ARGF.class#internal_encoding -> Encoding | nil (20312.0)

ARGF から読み込んだ文字列の内部エンコーディングを返します。 内部エンコーディングが指定されていない場合は nil を返します。

...nil を返します。

まだ読み込み処理を始めていない場合は Encoding.default_external を返します。

ARGF.class#set_encoding で設定します。


例:
# $ ruby -Eutf-8 test.rb

# test.rb
ARGF.internal_encoding # => #<Encoding:UTF-8>
ARGF.set_encoding('u...
...tf-8','ascii')
ARGF.internal_encoding # => #<Encoding:US-ASCII>

例:
ARGF.binmode
ARGF.internal_encoding # => nil

@see IO, ARGF.class#external_encoding...

FileTest.#file?(file) -> bool (20200.0)

ファイルが通常ファイルである時に真を返します。そうでない場合、ファイルが存在しない場合、あるいはシステムコールに失敗した場合などには false を返します。

...file ファイル名を表す文字列か IO オブジェクトを指定します。

@raise IOError 指定された IO オブジェクト file が既に close されていた場合に発生します。

例:
FileTest.file?('/bin/bash') # => true
FileTest.file?('/bin') # => false
FileTest.fil...
...e?('/no_such_file') # => false...

GC.latest_gc_info(key) -> object (20200.0)

最新のGCの情報を返します。

...します。

//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 (20200.0)

最新のGCの情報を返します。

...します。

//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) # => :...

FileTest (20000.0)

ファイルの検査関数を集めたモジュールです。

...めたモジュールです。

=== 注意

FileTest で定義された各メソッドは、システムコールに失敗しても例外を発生させません。
真を返した時のみ、返り値は意味をもちます。
例えば、
File.exist?('/root/.bashrc')
が false を返しても、...

Exception#backtrace_locations -> [Thread::Backtrace::Location] (17230.0)

バックトレース情報を返します。Exception#backtraceに似ていますが、 Thread::Backtrace::Location の配列を返す点が異なります。

...ception#backtraceに似ていますが、
Thread::Backtrace::Location の配列を返す点が異なります。

現状では Exception#set_backtrace によって戻り値が変化する事はあり
ません。

//emlist[例: test.rb][ruby]{
require "date"
def check_long_month(month)
return if D...
...aise "#{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_exception'", "test.rb:15:i...
...n `<main>'"]
//}

@see Exception#backtrace...

String#encoding -> Encoding (17206.0)

文字列のエンコーディング情報を表現した Encoding オブジェクトを返します。

...列のエンコーディング情報を表現した Encoding オブジェクトを返します。

//emlist[例][ruby]{
# encoding: utf-8
utf8_str = "test"
euc_str = utf8_str.encode("EUC-JP")
utf8_str.encoding # => #<Encoding:UTF-8>
euc_str.encoding # => #<Encoding:EUC-JP>
//}

@see Encoding...

TracePoint#inspect -> String (17206.0)

self の状態を人間に読みやすい文字列にして返します。

...self の状態を人間に読みやすい文字列にして返します。

//emlist[例][ruby]{
def foo(ret)
ret
end
trace = TracePoint.new(:call) do |tp|
p tp.inspect # "#<TracePoint:call `foo'@/path/to/test.rb:1>"
end
trace.enable
foo 1
//}...

絞り込み条件を変える

<< 1 2 3 ... > >>