るりまサーチ

最速Rubyリファレンスマニュアル検索!
8020件ヒット [1-100件を表示] (0.155秒)

別のキーワード

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

ライブラリ

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

TracePoint#binding -> Binding (29601.0)

発生したイベントによって生成された Binding オブジェクトを返します。

...発生したイベントによって生成された Binding オブジェクトを返します。


//emlist[例][ruby]{
def foo(ret)
ret
end
trace = TracePoint.new(:call) do |tp|
p tp.binding.local_variables # => [:ret]
end
trace.enable
foo 1
//}...

TracePoint#binding -> Binding | nil (29601.0)

発生したイベントによって生成された Binding オブジェクトを返します。

...れた Binding オブジェクトを返します。

C で記述されたメソッドは binding を生成しないため、
:c_call および :c_return イベントに対しては nil を返すことに注意してください。

//emlist[例][ruby]{
def foo(ret)
ret
end
trace = TracePoint.new(:...
...call) do |tp|
p tp.binding.local_variables # => [:ret]
end
trace.enable
foo 1
//}...

Encoding::InvalidByteSequenceError#destination_encoding -> Encoding (29301.0)

エラーを発生させた変換の変換先のエンコーディングを Encoding オブジェクトで返します。

...エラーを発生させた変換の変換先のエンコーディングを Encoding
オブジェクトで返します。

@see Encoding::InvalidByteSequenceError#source_encoding,
Encoding::UndefinedConversionError#destination_encoding...

Encoding::InvalidByteSequenceError#destination_encoding_name -> String (29301.0)

エラーを発生させた変換の変換先のエンコーディングを文字列で返します。

...エラーを発生させた変換の変換先のエンコーディングを文字列で返します。

@see Encoding::InvalidByteSequenceError#destination_encoding...

Encoding::InvalidByteSequenceError#incomplete_input? -> bool (29301.0)

エラー発生時に入力文字列が不足している場合に真を返します。

.../emlist[例][ruby]{
ec = Encoding::Converter.new("EUC-JP", "ISO-8859-1")

b
egin
ec.convert("abc\xA1z")
rescue Encoding::InvalidByteSequenceError
p $!
#=> #<Encoding::InvalidByteSequenceError: "\xA1" followed by "z" on EUC-JP>
p $!.incomplete_input? #=> false
end

b
egin
ec.convert("abc\x...
...A1")
ec.finish
rescue Encoding::InvalidByteSequenceError
p $! #=> #<Encoding::InvalidByteSequenceError: incomplete "\xA1" on EUC-JP>
p $!.incomplete_input? #=> true
end
//}...

絞り込み条件を変える

Encoding::InvalidByteSequenceError#readagain_bytes -> String (29301.0)

エラー発生時に読み直さなければならないバイト列を返します。

...エラー発生時に読み直さなければならないバイト列を返します。

@see Encoding::InvalidByteSequenceError#error_bytes...

String#b -> String (29208.0)

self の文字エンコーディングを ASCII-8BIT にした文字列の複製を返します。

...self の文字エンコーディングを ASCII-8BIT にした文字列の複製を返します。

//emlist[例][ruby]{
'abc123'.encoding # => #<Encoding:UTF-8>
'abc123'.b.encoding # => #<Encoding:ASCII-8BIT>
//}...

Proc#binding -> Binding (26601.0)

Proc オブジェクトが保持するコンテキストを Binding オブジェクトで返します。

...Proc オブジェクトが保持するコンテキストを
B
inding オブジェクトで返します。

//emlist[例][ruby]{
def fred(param)
proc {}
end

sample_proc = fred(99)
eval("param", sample_proc.binding) # => 99
//}...

Object#instance_variable_defined?(var) -> bool (26313.0)

インスタンス変数 var が定義されていたら真を返します。

...文字列か Symbol で指定します。

//emlist[][ruby]{
class Fred
def initialize(p1, p2)
@a, @b = p1, p2
end
end
fred = Fred.new('cat', 99)
p fred.instance_variable_defined?(:@a) #=> true
p fred.instance_variable_defined?("@b") #=> true
p fred.instance_variable_defined?("@c") #=...
...> false
//}

@see Object#instance_variable_get,Object#instance_variable_set,Object#instance_variables...

Binding#local_variable_defined?(symbol) -> bool (26207.0)

引数 symbol で指定した名前のローカル変数が定義されている場合に true を、 そうでない場合に false を返します。

...ymbol で指定した名前のローカル変数が定義されている場合に true を、
そうでない場合に false を返します。

@param symbol ローカル変数名を Symbol オブジェクトで指定します。

//emlist[例][ruby]{
def foo
a = 1
b
inding.local_variable_define...
...d?(:a) # => true
b
inding.local_variable_defined?(:b) # => false
end
//}

このメソッドは以下のコードの短縮形です。

//emlist[][ruby]{
b
inding.eval("defined?(#{symbol}) == 'local-variable'")
//}

@see Binding#local_variable_get, Binding#local_variable_set...

絞り込み条件を変える

Enumerable#find_index {|obj| ... } -> Integer | nil (23437.0)

条件に一致する最初の要素の位置を返します。

...等しい最初の要素の位置を返します。
等しい要素がひとつもなかった場合は nil を返します。

//emlist[例][ruby]{
(1..10).find_index(11) #=> nil
(1..10).find_index(2) #=> 1
//}

ブロックが与えられた場合には、各要素を引数として先頭から...
...素の位置を返します。
一つも真にならなかった場合は nil を返します。

//emlist[例][ruby]{
(1..10).find_index {|i| i % 5 == 0 and i % 7 == 0 } #=> nil
(1..100).find_index {|i| i % 5 == 0 and i % 7 == 0 } #=> 34
//}

引数、ブロックのどちらも与えられな...
<< 1 2 3 ... > >>