るりまサーチ

最速Rubyリファレンスマニュアル検索!
120件ヒット [1-100件を表示] (0.073秒)
トップページ > クエリ:String[x] > クエリ:string[x] > クエリ:@[x] > クエリ:method[x] > 種類:特異メソッド[x]

別のキーワード

  1. string []=
  2. string slice
  3. string slice!
  4. string []
  5. string gsub!

ライブラリ

オブジェクト

キーワード

検索結果

<< 1 2 > >>

JSON::Generator::GeneratorMethods::String::Extend.json_create(hash) -> String (9221.0)

JSON のオブジェクトから Ruby の文字列を生成して返します。

...のオブジェクトから Ruby の文字列を生成して返します。

@
param hash キーとして "raw" という文字列を持ち、その値として数値の配列を持つハッシュを指定します。

require 'json'
String
.json_create({"raw" => [0x41, 0x42, 0x43]}) # => "ABC"...

IRB::ExtendCommandBundle.irb_original_method_name(method_name) -> String (6445.0)

method_name で指定したメソッドの irb 中でのエイリアスを返します。ライブ ラリ内部で使用します。

...
method
_name で指定したメソッドの irb 中でのエイリアスを返します。ライブ
ラリ内部で使用します。

@
param method_name メソッド名を Symbol か文字列で指定します。

@
see IRB::ExtendCommandBundle#install_alias_method...

main.define_method(name, method) -> Symbol (6270.0)

インスタンスメソッド name を Object に定義します。

...れます。

@
param name String または Symbol を指定します。

@
param method Proc、Method あるいは UnboundMethod
いずれかのインスタンスを指定します。

@
return メソッド名を表す Symbol を返します。

@
raise TypeError method に同じク...
...ラス、サブクラス以外のメソッドを指定し
た場合に発生します。


@
see Module#define_method...

main.define_method(name) { ... } -> Symbol (6170.0)

インスタンスメソッド name を Object に定義します。

...れます。

@
param name String または Symbol を指定します。

@
param method Proc、Method あるいは UnboundMethod
いずれかのインスタンスを指定します。

@
return メソッド名を表す Symbol を返します。

@
raise TypeError method に同じク...
...ラス、サブクラス以外のメソッドを指定し
た場合に発生します。


@
see Module#define_method...

IRB::Context.new(irb, workspace = nil, input_method = nil, output_method = nil) -> IRB::Context (251.0)

自身を初期化します。

...を初期化します。

@
param irb IRB::Irb オブジェクトを指定します。

@
param workspace IRB::WorkSpace オブジェクトを指定します。省略し
た場合は新しく作成されます。

@
param input_method String、IRB::InputMethod のサブクラスの...
...ジェクト、nil のいずれかを指定します。

@
param output_method IRB::OutputMethod のサブクラスのオブジェクト
を指定します。省略した場合は
IRB::StdioOutputMethod オブジェクトが新しく
...

絞り込み条件を変える

RubyVM::InstructionSequence.disasm(body) -> String (247.0)

引数 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>@/tmp/proc.r...
...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...
...2)
0004 putself
0005 putstring "hello, world"
0007 send :puts, 1, nil, 8, <ic:0>
0013 trace 16 ( 3)
0015 leave ( 2)

@
see RubyVM::InstructionSequence...

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

引数 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>@/tmp/proc.r...
...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...
...2)
0004 putself
0005 putstring "hello, world"
0007 send :puts, 1, nil, 8, <ic:0>
0013 trace 16 ( 3)
0015 leave ( 2)

@
see RubyVM::InstructionSequence...

Regexp.last_match(nth) -> String | nil (215.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...
...l:NilClass
end
p Regexp.last_match(1) # => nil
//}

@
param nth 整数を指定します。
整数 nth が 0 の場合、マッチした文字列を返します。それ以外では、nth 番目の括弧にマッチした部分文字列を返します。...

TracePoint.new(*events) {|obj| ... } -> TracePoint (31.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...
...レースを無効にするには TracePoint#disable を実行してください。

//emlist[][ruby]{
trace.disable
//}

@
param events トレースするイベントを String か Symbol で任
意の数指定します。

: :line

式の評価。

: :class

クラス定義、特...
...発生します。

//emlist[例][ruby]{
TracePoint.trace(:line) do |tp|
$tp = tp
end
$tp.lineno # => access from outside (RuntimeError)
//}

他のスレッドから参照する事も禁じられています。

@
raise ThreadError ブロックを指定しなかった場合に発生します。...
...生します。

//emlist[例][ruby]{
TracePoint.trace(:line) do |tp|
$tp = tp
end
$tp.lineno # => access from outside (RuntimeError)
//}

他のスレッドから参照する事も禁じられています。

@
raise ArgumentError ブロックを指定しなかった場合に発生します。...
<< 1 2 > >>