別のキーワード
ライブラリ
- ビルトイン (7)
-
irb
/ context (1) -
irb
/ extend-command (1) - json (1)
クラス
-
IRB
:: Context (1) - Regexp (2)
-
RubyVM
:: InstructionSequence (2) - TracePoint (1)
オブジェクト
- main (2)
キーワード
-
define
_ method (2) - disasm (1)
- disassemble (1)
-
irb
_ original _ method _ name (1) -
json
_ create (1) -
last
_ match (2) - new (2)
検索結果
先頭5件
- IRB
:: ExtendCommandBundle . irb _ original _ method _ name(method _ name) -> String - main
. define _ method(name , method) -> Symbol - main
. define _ method(name) { . . . } -> Symbol - JSON
:: Generator :: GeneratorMethods :: String :: Extend . json _ create(hash) -> String - IRB
:: Context . new(irb , workspace = nil , input _ method = nil , output _ method = nil) -> IRB :: Context
-
IRB
:: ExtendCommandBundle . irb _ original _ method _ name(method _ name) -> String (18997.0) -
method_name で指定したメソッドの irb 中でのエイリアスを返します。ライブ ラリ内部で使用します。
method_name で指定したメソッドの irb 中でのエイリアスを返します。ライブ
ラリ内部で使用します。
@param method_name メソッド名を Symbol か文字列で指定します。
@see IRB::ExtendCommandBundle#install_alias_method -
main
. define _ method(name , method) -> Symbol (18703.0) -
インスタンスメソッド name を Object に定義します。
インスタンスメソッド name を Object に定義します。
ブロックを与えた場合、定義したメソッドの実行時にブロックが
Object インスタンスの上で BasicObject#instance_eval されます。
@param name String または Symbol を指定します。
@param method Proc、Method あるいは UnboundMethod の
いずれかのインスタンスを指定します。
@return メソッド名を表す Symbol を返します。
@raise TypeError method に同じクラス、サブ... -
main
. define _ method(name) { . . . } -> Symbol (18403.0) -
インスタンスメソッド name を Object に定義します。
インスタンスメソッド name を Object に定義します。
ブロックを与えた場合、定義したメソッドの実行時にブロックが
Object インスタンスの上で BasicObject#instance_eval されます。
@param name String または Symbol を指定します。
@param method Proc、Method あるいは UnboundMethod の
いずれかのインスタンスを指定します。
@return メソッド名を表す Symbol を返します。
@raise TypeError method に同じクラス、サブ... -
JSON
:: Generator :: GeneratorMethods :: String :: Extend . json _ create(hash) -> String (18325.0) -
JSON のオブジェクトから Ruby の文字列を生成して返します。
JSON のオブジェクトから Ruby の文字列を生成して返します。
@param hash キーとして "raw" という文字列を持ち、その値として数値の配列を持つハッシュを指定します。
require 'json'
String.json_create({"raw" => [0x41, 0x42, 0x43]}) # => "ABC" -
IRB
:: Context . new(irb , workspace = nil , input _ method = nil , output _ method = nil) -> IRB :: Context (664.0) -
自身を初期化します。
自身を初期化します。
@param irb IRB::Irb オブジェクトを指定します。
@param workspace IRB::WorkSpace オブジェクトを指定します。省略し
た場合は新しく作成されます。
@param input_method String、IRB::InputMethod のサブクラスの
オブジェクト、nil のいずれかを指定します。
@param output_method IRB::OutputMethod のサブクラスのオブジェクト
... -
RubyVM
:: InstructionSequence . disasm(body) -> String (400.0) -
引数 body で指定したオブジェクトから作成した RubyVM::InstructionSequence オブジェクトを人間が読める形式の文字 列に変換して返します。
引数 body で指定したオブジェクトから作成した
RubyVM::InstructionSequence オブジェクトを人間が読める形式の文字
列に変換して返します。
@param body Proc、Method オブジェクトを指定します。
例1:Proc オブジェクトを指定した場合
# /tmp/proc.rb
p = proc { num = 1 + 2 }
puts RubyVM::InstructionSequence.disasm(p)
出力:
== disasm: <RubyVM::InstructionSequence:block in <main... -
RubyVM
:: InstructionSequence . disassemble(body) -> String (400.0) -
引数 body で指定したオブジェクトから作成した RubyVM::InstructionSequence オブジェクトを人間が読める形式の文字 列に変換して返します。
引数 body で指定したオブジェクトから作成した
RubyVM::InstructionSequence オブジェクトを人間が読める形式の文字
列に変換して返します。
@param body Proc、Method オブジェクトを指定します。
例1:Proc オブジェクトを指定した場合
# /tmp/proc.rb
p = proc { num = 1 + 2 }
puts RubyVM::InstructionSequence.disasm(p)
出力:
== disasm: <RubyVM::InstructionSequence:block in <main... -
Regexp
. last _ match(nth) -> String | nil (325.0) -
整数 nth が 0 の場合、マッチした文字列を返します ($&)。それ以外では、nth 番目の括弧にマッチ した部分文字列を返します($1,$2,...)。 対応する括弧がない場合やマッチしなかった場合には nil を返し ます。
整数 nth が 0 の場合、マッチした文字列を返します
($&)。それ以外では、nth 番目の括弧にマッチ
した部分文字列を返します($1,$2,...)。
対応する括弧がない場合やマッチしなかった場合には nil を返し
ます。
//emlist[例][ruby]{
/(.)(.)/ =~ "ab"
p Regexp.last_match # => #<MatchData:0x4599e58>
p Regexp.last_match(0) # => "ab"
p Regexp.last_match(1) # => "a"
p Regexp.last_match(2) ... -
TracePoint
. new(*events) {|obj| . . . } -> TracePoint (40.0) -
新しい TracePoint オブジェクトを作成して返します。トレースを有効 にするには TracePoint#enable を実行してください。
新しい 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!"
# .... -
Regexp
. last _ match -> MatchData (10.0) -
カレントスコープで最後に行った正規表現マッチの MatchData オ ブジェクトを返します。このメソッドの呼び出しは $~ の参照と同じです。
カレントスコープで最後に行った正規表現マッチの MatchData オ
ブジェクトを返します。このメソッドの呼び出しは $~
の参照と同じです。
//emlist[例][ruby]{
/(.)(.)/ =~ "ab"
p Regexp.last_match # => #<MatchData:0x4599e58>
p Regexp.last_match[0] # => "ab"
p Regexp.last_match[1] # => "a"
p Regexp.last_match[2] # => "b"
p Regexp.last_match[3] # => nil...