別のキーワード
クラス
- Enumerator (14)
- NoMethodError (17)
- Regexp (22)
-
RubyVM
:: InstructionSequence (33) - TracePoint (11)
モジュール
オブジェクト
- main (22)
キーワード
-
define
_ method (22) - disasm (11)
- disassemble (11)
-
last
_ match (22) - new (42)
- of (19)
検索結果
先頭5件
- main
. define _ method(name , method) -> Symbol - main
. define _ method(name) { . . . } -> Symbol - NoMethodError
. new(error _ message = "" , name = nil , args = nil) -> NoMethodError - NoMethodError
. new(error _ message = "" , name = nil , args = nil , priv = false) -> NoMethodError - NoMethodError
. new(error _ message = "" , name = nil , args = nil , priv = false , receiver:) -> NoMethodError
-
main
. define _ method(name , method) -> Symbol (12457.0) -
インスタンスメソッド name を Object に定義します。
...または Symbol を指定します。
@param method Proc、Method あるいは UnboundMethod の
いずれかのインスタンスを指定します。
@return メソッド名を表す Symbol を返します。
@raise TypeError method に同じクラス、サブクラス以外の......メソッドを指定し
た場合に発生します。
@see Module#define_method... -
main
. define _ method(name) { . . . } -> Symbol (12257.0) -
インスタンスメソッド name を Object に定義します。
...または Symbol を指定します。
@param method Proc、Method あるいは UnboundMethod の
いずれかのインスタンスを指定します。
@return メソッド名を表す Symbol を返します。
@raise TypeError method に同じクラス、サブクラス以外の......メソッドを指定し
た場合に発生します。
@see Module#define_method... -
NoMethodError
. new(error _ message = "" , name = nil , args = nil) -> NoMethodError (6203.0) -
例外オブジェクトを生成して返します。
...param error_message エラーメッセージを表す文字列です
@param name 未定義だったシンボルです
@param args メソッド呼び出しに使われた引数です
例:
nom = NoMethodError.new("message", "foo", [1,2,3])
p nom.name
p nom.args
# => "foo"
[1, 2, 3]... -
NoMethodError
. new(error _ message = "" , name = nil , args = nil , priv = false) -> NoMethodError (6203.0) -
例外オブジェクトを生成して返します。
...に使われた引数です
@param priv private なメソッドを呼び出せる形式 (関数形式(レシーバを省略した形式)) で呼ばれたかどうかを指定します
例:
nom = NoMethodError.new("message", "foo", [1,2,3])
p nom.name
p nom.args
# => "foo"
[1, 2, 3]......形式 (関数形式(レシーバを省略した形式)) で呼ばれたかどうかを指定します
@param receiver 原因となったメソッド呼び出しのレシーバです
例:
nom = NoMethodError.new("message", "foo", [1,2,3])
p nom.name
p nom.args
# => "foo"
[1, 2, 3]... -
NoMethodError
. new(error _ message = "" , name = nil , args = nil , priv = false , receiver:) -> NoMethodError (6203.0) -
例外オブジェクトを生成して返します。
...形式 (関数形式(レシーバを省略した形式)) で呼ばれたかどうかを指定します
@param receiver 原因となったメソッド呼び出しのレシーバです
例:
nom = NoMethodError.new("message", "foo", [1,2,3])
p nom.name
p nom.args
# => "foo"
[1, 2, 3]... -
Enumerator
. new(obj , method = :each , *args) -> Enumerator (281.0) -
オブジェクト obj について、 each の代わりに method という 名前のメソッドを使って繰り返すオブジェクトを生成して返します。 args を指定すると、 method の呼び出し時に渡されます。
...わりに method という
名前のメソッドを使って繰り返すオブジェクトを生成して返します。
args を指定すると、 method の呼び出し時に渡されます。
@param obj イテレータメソッドのレシーバとなるオブジェクト
@param method イテレ... -
RubyVM
:: InstructionSequence . of(body) -> RubyVM :: InstructionSequence (83.0) -
引数 body で指定した Proc、Method オブジェクトを元に RubyVM::InstructionSequence オブジェクトを作成して返します。
...引数 body で指定した Proc、Method オブジェクトを元に
RubyVM::InstructionSequence オブジェクトを作成して返します。
@param body Proc、Method オブジェクトを指定します。
例1:irb で実行した場合
# proc
> p = proc { num = 1 + 2 }
> RubyVM::In......structionSequence.of(p)
> # => <RubyVM::InstructionSequence:block in irb_binding@(irb)>
# method
> def foo(bar); puts bar; end
> RubyVM::InstructionSequence.of(method(:foo))
> # => <RubyVM::InstructionSequence:foo@(irb)>
例2: RubyVM::InstructionSequence.compile_file を使用した場......end
$a_global_proc = proc { str = 'a' + 'b' }
# irb
> require '/tmp/iseq_of.rb'
# hello メソッド
> RubyVM::InstructionSequence.of(method(:hello))
> # => #<RubyVM::InstructionSequence:0x007fb73d7cb1d0>
# グローバル proc
> RubyVM::InstructionSequence.of($a_global_proc)
>... -
RubyVM
:: InstructionSequence . disasm(body) -> String (63.0) -
引数 body で指定したオブジェクトから作成した RubyVM::InstructionSequence オブジェクトを人間が読める形式の文字 列に変換して返します。
...成した
RubyVM::InstructionSequence オブジェクトを人間が読める形式の文字
列に変換して返します。
@param body Proc、Method オブジェクトを指定します。
例1:Proc オブジェクトを指定した場合
# /tmp/proc.rb
p = proc { num = 1 + 2 }
puts Rub......num, 0
0012 leave
例2:Method オブジェクトを指定した場合
# /tmp/method.rb
def hello
puts "hello, world"
end
puts RubyVM::InstructionSequence.disasm(method(:hello))
出力:
== disasm: <RubyVM::InstructionSequence:hello@/tmp/method.rb>============
0000 trace... -
RubyVM
:: InstructionSequence . disassemble(body) -> String (63.0) -
引数 body で指定したオブジェクトから作成した RubyVM::InstructionSequence オブジェクトを人間が読める形式の文字 列に変換して返します。
...成した
RubyVM::InstructionSequence オブジェクトを人間が読める形式の文字
列に変換して返します。
@param body Proc、Method オブジェクトを指定します。
例1:Proc オブジェクトを指定した場合
# /tmp/proc.rb
p = proc { num = 1 + 2 }
puts Rub......num, 0
0012 leave
例2:Method オブジェクトを指定した場合
# /tmp/method.rb
def hello
puts "hello, world"
end
puts RubyVM::InstructionSequence.disasm(method(:hello))
出力:
== disasm: <RubyVM::InstructionSequence:hello@/tmp/method.rb>============
0000 trace... -
Regexp
. last _ match(nth) -> String | nil (15.0) -
整数 nth が 0 の場合、マッチした文字列を返します ($&)。それ以外では、nth 番目の括弧にマッチ した部分文字列を返します($1,$2,...)。 対応する括弧がない場合やマッチしなかった場合には nil を返し ます。
...例外 NoMethodError が発生します。
対して、last_match(1) は nil を返します。
//emlist[例][ruby]{
str = "This is Regexp"
/That is Regexp/ =~ str
p Regexp.last_match # => nil
begin
p Regexp.last_match[1] # 例外が発生する
rescue
puts $! # => undefined method `[]' for ni... -
RubyVM
:: AbstractSyntaxTree . of(proc) -> RubyVM :: AbstractSyntaxTree :: Node (15.0) -
引数 proc に渡したProcやメソッドオブジェクトの抽象構文木を返します。
...44 (LIT@2:39-2:40 1) :+
# (LIST@2:43-2:44 (LIT@2:43-2:44 2) nil)))
def hello
puts "hello, world"
end
pp RubyVM::AbstractSyntaxTree.of(method(:hello))
# => (SCOPE@5:0-7:3
# tbl: []
# args:
# (ARGS@5:9-5:9
# pre_num: 0
# pre_init: nil
# opt: nil
#... -
RubyVM
:: AbstractSyntaxTree . of(proc , keep _ script _ lines: false , error _ tolerant: false , keep _ tokens: false) -> RubyVM :: AbstractSyntaxTree :: Node (15.0) -
引数 proc に渡したProcやメソッドオブジェクトの抽象構文木を返します。
...44 (LIT@2:39-2:40 1) :+
# (LIST@2:43-2:44 (LIT@2:43-2:44 2) nil)))
def hello
puts "hello, world"
end
pp RubyVM::AbstractSyntaxTree.of(method(:hello))
# => (SCOPE@5:0-7:3
# tbl: []
# args:
# (ARGS@5:9-5:9
# pre_num: 0
# pre_init: nil
# opt: nil
#... -
TracePoint
. new(*events) {|obj| . . . } -> TracePoint (15.0) -
新しい TracePoint オブジェクトを作成して返します。トレースを有効 にするには TracePoint#enable を実行してください。
...してください。
//emlist[例:irb で実行した場合][ruby]{
trace = TracePoint.new(:call) do |tp|
p [tp.lineno, tp.defined_class, tp.method_id, tp.event]
end
# => #<TracePoint:0x007f17372cdb20>
trace.enable
# => false
puts "Hello, TracePoint!"
# ...
# [69, IRB::Notifier::AbstractNoti...