るりまサーチ

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

別のキーワード

  1. _builtin main
  2. main define_method
  3. main public
  4. main private
  5. main to_s

ライブラリ

クラス

オブジェクト

キーワード

検索結果

<< < ... 2 3 4 >>

RubyVM::InstructionSequence.disassemble(body) -> String (7.0)

引数 body で指定したオブジェクトから作成した RubyVM::InstructionSequence オブジェクトを人間が読める形式の文字 列に変換して返します。

.../tmp/proc.rb
p = proc { num = 1 + 2 }
puts RubyVM::InstructionSequence.disasm(p)

出力:

== disasm: <RubyVM::InstructionSequence:block in <main>@/tmp/proc.rb>===
== catch table
| catch type: redo st: 0000 ed: 0012 sp: 0000 cont: 0000
| catch type: next st: 0000 ed: 0012 sp: 0000 c...

Struct.new(*args) -> Class (7.0)

Struct クラスに新しいサブクラスを作って、それを返します。

...れます。

//emlist[例][ruby]{
Customer = Struct.new(:name, :address) do
def greeting
"Hello #{name}!"
end
end
Customer.new("Dave", "123 Main").greeting # => "Hello Dave!"
//}

Structをカスタマイズする場合はこの方法が推奨されます。無名クラスのサブ
クラ...

Struct.new(*args) {|subclass| block } -> Class (7.0)

Struct クラスに新しいサブクラスを作って、それを返します。

...れます。

//emlist[例][ruby]{
Customer = Struct.new(:name, :address) do
def greeting
"Hello #{name}!"
end
end
Customer.new("Dave", "123 Main").greeting # => "Hello Dave!"
//}

Structをカスタマイズする場合はこの方法が推奨されます。無名クラスのサブ
クラ...

Struct.new(*args, keyword_init: false) -> Class (7.0)

Struct クラスに新しいサブクラスを作って、それを返します。

...れます。

//emlist[例][ruby]{
Customer = Struct.new(:name, :address) do
def greeting
"Hello #{name}!"
end
end
Customer.new("Dave", "123 Main").greeting # => "Hello Dave!"
//}

Structをカスタマイズする場合はこの方法が推奨されます。無名クラスのサブ
クラ...

Struct.new(*args, keyword_init: false) {|subclass| block } -> Class (7.0)

Struct クラスに新しいサブクラスを作って、それを返します。

...れます。

//emlist[例][ruby]{
Customer = Struct.new(:name, :address) do
def greeting
"Hello #{name}!"
end
end
Customer.new("Dave", "123 Main").greeting # => "Hello Dave!"
//}

Structをカスタマイズする場合はこの方法が推奨されます。無名クラスのサブ
クラ...

絞り込み条件を変える

Struct.new(*args, keyword_init: nil) -> Class (7.0)

Struct クラスに新しいサブクラスを作って、それを返します。

...れます。

//emlist[例][ruby]{
Customer = Struct.new(:name, :address) do
def greeting
"Hello #{name}!"
end
end
Customer.new("Dave", "123 Main").greeting # => "Hello Dave!"
//}

Structをカスタマイズする場合はこの方法が推奨されます。無名クラスのサブ
クラ...

Struct.new(*args, keyword_init: nil) {|subclass| block } -> Class (7.0)

Struct クラスに新しいサブクラスを作って、それを返します。

...れます。

//emlist[例][ruby]{
Customer = Struct.new(:name, :address) do
def greeting
"Hello #{name}!"
end
end
Customer.new("Dave", "123 Main").greeting # => "Hello Dave!"
//}

Structをカスタマイズする場合はこの方法が推奨されます。無名クラスのサブ
クラ...

Thread.report_on_exception -> bool (7.0)

真の時は、いずれかのスレッドが例外によって終了した時に、その内容を $stderr に報告します。

...#<Thread:...> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
2: from -e:1:in `block in <main>'
1: from -e:1:in `times'

これによってスレッドのエラーを早期に捕捉できるようになります。
いくつかの...

Thread.report_on_exception=(newstate) (7.0)

真の時は、いずれかのスレッドが例外によって終了した時に、その内容を $stderr に報告します。

...#<Thread:...> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
2: from -e:1:in `block in <main>'
1: from -e:1:in `times'

これによってスレッドのエラーを早期に捕捉できるようになります。
いくつかの...

Struct.[](*args) -> Struct (2.0)

(このメソッドは Struct の下位クラスにのみ定義されています) 構造体オブジェクトを生成して返します。

(このメソッドは Struct の下位クラスにのみ定義されています)
構造体オブジェクトを生成して返します。

@param args 構造体の初期値を指定します。メンバの初期値は指定されなければ nil です。

@return 構造体クラスのインスタンス。

@raise ArgumentError 構造体のメンバの数よりも多くの引数を指定した場合に発生します。

//emlist[例][ruby]{
Foo = Struct.new(:foo, :bar)
foo = Foo.new(1)
p foo.values # => [1, nil]
//}

絞り込み条件を変える

Struct.new(*args) -> Struct (2.0)

(このメソッドは Struct の下位クラスにのみ定義されています) 構造体オブジェクトを生成して返します。

(このメソッドは Struct の下位クラスにのみ定義されています)
構造体オブジェクトを生成して返します。

@param args 構造体の初期値を指定します。メンバの初期値は指定されなければ nil です。

@return 構造体クラスのインスタンス。

@raise ArgumentError 構造体のメンバの数よりも多くの引数を指定した場合に発生します。

//emlist[例][ruby]{
Foo = Struct.new(:foo, :bar)
foo = Foo.new(1)
p foo.values # => [1, nil]
//}
<< < ... 2 3 4 >>