ライブラリ
- ビルトイン (296)
-
irb
/ inspector (12) - socket (60)
クラス
- Data (6)
- Dir (24)
-
IRB
:: Inspector (12) - Proc (14)
-
RubyVM
:: InstructionSequence (36) - Socket (60)
- Struct (48)
- Thread (42)
オブジェクト
- main (126)
キーワード
- [] (20)
-
compile
_ file (12) -
def
_ inspector (12) - define (6)
-
define
_ method (24) - disasm (12)
- disassemble (12)
- gethostbyname (12)
- glob (16)
- include (12)
- inspect (12)
- new (62)
- open (12)
- pair (12)
- pass (12)
- private (27)
- public (27)
-
report
_ on _ exception (9) -
report
_ on _ exception= (9) - socketpair (12)
-
to
_ s (12) - using (12)
検索結果
先頭5件
-
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]
//}