るりまサーチ

最速Rubyリファレンスマニュアル検索!
996件ヒット [301-400件を表示] (0.219秒)

別のキーワード

  1. openssl t61string
  2. asn1 t61string
  3. matrix t
  4. t61string new
  5. fiddle type_size_t

ライブラリ

キーワード

検索結果

<< < ... 2 3 4 5 6 ... > >>

Kernel.#caller(range) -> [String] | nil (9220.0)

start 段上の呼び出し元の情報を $@ の形式のバックトレース(文字列の配列)として返します。

...start 段上の呼び出し元の情報を $@
の形式のバックトレース(文字列の配列)として返します。

トップレベルでは空の配列を返します。caller の戻り値を $@ に代入することで
例外の発生位置を設定できます。

引数で指定した...
...start long の範囲を超えない正の整数でスタックレベルを指定します。
@param length 取得するスタックの個数を指定します。

@param range 取得したいスタックの範囲を示す Range オブジェクトを指定します。

@see Kernel.#set_trace_func,Ker...
...nel.#raise,
Kernel
.#caller_locations

//emlist[例][ruby]{
def foo
p caller(0)
p caller(1)
p caller(2)
p caller(3)
p caller(4)
e
nd

def bar
foo
e
nd

bar

#=> ["-:2:in `foo'", "-:10:in `bar'", "-:13:in `<main>'"]
# ["-:10:in `bar'", "-:13:in `<main>'"]
# ["-:13:in `<main>'"]
#...

Kernel.#caller(start = 1) -> [String] | nil (9220.0)

start 段上の呼び出し元の情報を $@ の形式のバックトレース(文字列の配列)として返します。

...start 段上の呼び出し元の情報を $@
の形式のバックトレース(文字列の配列)として返します。

トップレベルでは空の配列を返します。caller の戻り値を $@ に代入することで
例外の発生位置を設定できます。

引数で指定した...
...start long の範囲を超えない正の整数でスタックレベルを指定します。
@param length 取得するスタックの個数を指定します。

@param range 取得したいスタックの範囲を示す Range オブジェクトを指定します。

@see Kernel.#set_trace_func,Ker...
...nel.#raise,
Kernel
.#caller_locations

//emlist[例][ruby]{
def foo
p caller(0)
p caller(1)
p caller(2)
p caller(3)
p caller(4)
e
nd

def bar
foo
e
nd

bar

#=> ["-:2:in `foo'", "-:10:in `bar'", "-:13:in `<main>'"]
# ["-:10:in `bar'", "-:13:in `<main>'"]
# ["-:13:in `<main>'"]
#...

Kernel.#caller(start, length) -> [String] | nil (9220.0)

start 段上の呼び出し元の情報を $@ の形式のバックトレース(文字列の配列)として返します。

...start 段上の呼び出し元の情報を $@
の形式のバックトレース(文字列の配列)として返します。

トップレベルでは空の配列を返します。caller の戻り値を $@ に代入することで
例外の発生位置を設定できます。

引数で指定した...
...start long の範囲を超えない正の整数でスタックレベルを指定します。
@param length 取得するスタックの個数を指定します。

@param range 取得したいスタックの範囲を示す Range オブジェクトを指定します。

@see Kernel.#set_trace_func,Ker...
...nel.#raise,
Kernel
.#caller_locations

//emlist[例][ruby]{
def foo
p caller(0)
p caller(1)
p caller(2)
p caller(3)
p caller(4)
e
nd

def bar
foo
e
nd

bar

#=> ["-:2:in `foo'", "-:10:in `bar'", "-:13:in `<main>'"]
# ["-:10:in `bar'", "-:13:in `<main>'"]
# ["-:13:in `<main>'"]
#...

Kernel.#iterator? -> bool (9220.0)

メソッドにブロックが与えられていれば真を返します。

...se を返します。

iterator? は (ブロックが必ずイテレートするとはいえないので)推奨されていないの
で block_given? を使ってください。

//emlist[例][ruby]{
def check
if block_given?
puts "Block is given."
e
lse
puts "Block isn't given."
e
n...
...d
e
nd
check{} #=> Block is given.
check #=> Block isn't given.
//}...

Kernel.#String(arg) -> String (9208.0)

引数を文字列(String)に変換した結果を返します。

...引数を文字列(String)に変換した結果を返します。

arg.to_s を呼び出して文字列に変換します。
arg が文字列の場合、何もせず arg を返します。

@param arg 変換対象のオブジェクトです。
@raise TypeError to_s の返り値が文字列でなけ...
...れば発生します。

//emlist[例][ruby]{
class Foo
def to_s
"hogehoge"
e
nd
e
nd

arg = Foo.new
p String(arg) #=> "hogehoge"
//}

@see Object#to_s,String...

絞り込み条件を変える

Kernel.#autoload(const_name, feature) -> nil (9208.0)

定数 const_name を最初に参照した時に feature を Kernel.#require するように設定します。

...const_name を最初に参照した時に feature
Kernel
.#require するように設定します。

const_name には、 "::" 演算子を含めることはできません。
ネストした定数を指定する方法は Module#autoload を参照してください。

const_name が autoload...
...い)ときは、
autoload する対象を置き換えます。
const_name が(autoloadではなく)既に定義されているときは何もしません。

@param const_name 定数をString または Symbol で指定します。
@param feature require と同様な方法で autoload する対象を...
...指定します。
@raise LoadError featureのロードに失敗すると発生します。

//emlist[][ruby]{
# ------- /tmp/foo.rb ---------
class Bar
e
nd
# ----- end of /tmp/foo.rb ----

autoload :Bar, '/tmp/foo'
p Bar #=> Bar
//}

@see Kernel.#autoload?,Module#autoload,Kernel.#require...

Kernel.#autoload?(const_name) -> String | nil (9208.0)

const_name が Kernel.#autoload 設定されているか調べます。

...const_name Kernel.#autoload 設定されているか調べます。

autoload 設定されていて、autoload 定数がまだ定義されてない(ロードされていない)
ときにそのパス名を返します。

autoload 設定されていないか、ロード済みなら nil を返し...
...t_name 定数をString または Symbol で指定します。

//emlist[例][ruby]{
# ------- /tmp/foo.rb ---------
class Foo
class Bar
e
nd
e
nd
# ----- end of /tmp/foo.rb ----

class Foo
e
nd
p Foo.autoload?(:Bar) #=> nil
Foo.autoload :Bar, '/tmp/foo'
p Foo.autoload?(:Bar) #=> "/t...
...mp/foo"
p Foo::Bar #=> Foo::Bar
p Foo.autoload?(:Bar) #=> nil
//}

@see Kernel.#autoload...

Kernel.#catch {|tag| .... } -> object (9208.0)

Kernel.#throwとの組み合わせで大域脱出を行います。 catch はブロックを実行します。

...
Kernel
.#throwとの組み合わせで大域脱出を行います。 catch はブロックを実行します。

ブロックの実行中に tag と同一のオブジェクトを引数とする Kernel.#throw が行われた
場合は、その throw の第二引数を戻り値として、ブロック...
...、ブロックパラメータ tag に
渡されます。

@param tag タグとなる任意のオブジェクトです。
@return ブロックの返り値か、対応するthrowの第二引数を返り値として返します。

//emlist[例][ruby]{
result = catch do |tag|
for i in 1..2
for j...
...in 1..2
for k in 1..2
throw tag, k
e
nd
e
nd
e
nd
e
nd

p result #=> 1
//}

@see Kernel.#throw...

Kernel.#catch(tag) {|tag| .... } -> object (9208.0)

Kernel.#throwとの組み合わせで大域脱出を行います。 catch はブロックを実行します。

...
Kernel
.#throwとの組み合わせで大域脱出を行います。 catch はブロックを実行します。

ブロックの実行中に tag と同一のオブジェクトを引数とする Kernel.#throw が行われた
場合は、その throw の第二引数を戻り値として、ブロック...
...、ブロックパラメータ tag に
渡されます。

@param tag タグとなる任意のオブジェクトです。
@return ブロックの返り値か、対応するthrowの第二引数を返り値として返します。

//emlist[例][ruby]{
result = catch do |tag|
for i in 1..2
for j...
...in 1..2
for k in 1..2
throw tag, k
e
nd
e
nd
e
nd
e
nd

p result #=> 1
//}

@see Kernel.#throw...
<< < ... 2 3 4 5 6 ... > >>