るりまサーチ

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

別のキーワード

  1. rbconfig ruby
  2. fiddle ruby_free
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

ライブラリ

キーワード

検索結果

<< 1 2 3 ... > >>

RubyVM::AbstractSyntaxTree::Node#inspect -> String (26126.0)

self のデバッグ用の情報を含んだ文字列を返します。

...self のデバッグ用の情報を含んだ文字列を返します。

//emlist[][ruby]{
node = RubyVM::AbstractSyntaxTree.parse('1 + 1')
puts
node.inspect
# => #<RubyVM::AbstractSyntaxTree::Node:SCOPE@1:0-1:5>
//}...

RubyVM::InstructionSequence#base_label -> String (26120.0)

self が表す命令シーケンスの基本ラベルを返します。

...た場合

iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>
iseq.base_label
# => "<compiled>"

例2: RubyVM::InstructionSequence.compile_file を使用した場合

# /tmp/method.rb
def hello
puts
"hello, world"
end...
...# irb
> iseq = RubyVM::InstructionSequence.compile_file('/tmp/method.rb')
> iseq.base_label # => "<main>"

例3:

# /tmp/method2.rb
def hello
puts
"hello, world"
end

Ruby
VM::InstructionSequence.of(method(:hello)).base_label
# => "hello"

@
see RubyVM::InstructionSequence#label...

RubyVM::InstructionSequence#label -> String (26120.0)

self が表す命令シーケンスのラベルを返します。通常、メソッド名、クラス名、 モジュール名などで構成されます。

... RubyVM::InstructionSequence.compile('num = 1 + 2')
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>
iseq.label
# => "<compiled>"

例2: RubyVM::InstructionSequence.compile_file を使用した場合

# /tmp/method.rb
def hello
puts
"hello, world"
end

# irb
> iseq = Ruby...
...VM::InstructionSequence.compile_file('/tmp/method.rb')
> iseq.label # => "<main>"

例3:

# /tmp/method2.rb
def hello
puts
"hello, world"
end

Ruby
VM::InstructionSequence.of(method(:hello)).label
# => "hello"

@
see RubyVM::InstructionSequence#base_label...

RubyVM::InstructionSequence#disasm -> String (26115.0)

self が表す命令シーケンスを人間が読める形式の文字列に変換して返します。

...令シーケンスを人間が読める形式の文字列に変換して返します。

puts
RubyVM::InstructionSequence.compile('1 + 2').disasm

出力:

== disasm: <RubyVM::InstructionSequence:<compiled>@<compiled>>==========
0000 trace 1...
...( 1)
0002 putobject 1
0004 putobject 2
0006 opt_plus <ic:1>
0008 leave

@
see RubyVM::InstructionSequence.disasm...

RubyVM::InstructionSequence#disassemble -> String (26115.0)

self が表す命令シーケンスを人間が読める形式の文字列に変換して返します。

...令シーケンスを人間が読める形式の文字列に変換して返します。

puts
RubyVM::InstructionSequence.compile('1 + 2').disasm

出力:

== disasm: <RubyVM::InstructionSequence:<compiled>@<compiled>>==========
0000 trace 1...
...( 1)
0002 putobject 1
0004 putobject 2
0006 opt_plus <ic:1>
0008 leave

@
see RubyVM::InstructionSequence.disasm...

絞り込み条件を変える

RubyVM::InstructionSequence#absolute_path -> String | nil (26114.0)

self が表す命令シーケンスの絶対パスを返します。

...= RubyVM::InstructionSequence.compile('num = 1 + 2')
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>
iseq.absolute_path
# => nil

例2: RubyVM::InstructionSequence.compile_file を使用した場合

# /tmp/method.rb
def hello
puts
"hello, world"
end

# irb
> iseq = Ruby...
...VM::InstructionSequence.compile_file('/tmp/method.rb')
> iseq.absolute_path # => "/tmp/method.rb"

@
see RubyVM::InstructionSequence#path...

RubyVM::InstructionSequence#path -> String (26114.0)

self が表す命令シーケンスの相対パスを返します。

...= RubyVM::InstructionSequence.compile('num = 1 + 2')
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>
iseq.path
# => "<compiled>"

例2: RubyVM::InstructionSequence.compile_file を使用した場合

# /tmp/method.rb
def hello
puts
"hello, world"
end

# irb
> iseq = Ruby...
...VM::InstructionSequence.compile_file('method.rb')
> iseq.path # => "method.rb"

@
see RubyVM::InstructionSequence#absolute_path...

String#gsub(pattern, replace) -> String (21223.0)

文字列中で pattern にマッチする部分全てを 文字列 replace で置き換えた文字列を生成して返します。

...

@
param pattern 置き換える文字列のパターンを表す文字列か正規表現。
文字列を指定した場合は全く同じ文字列にだけマッチする
@
param replace pattern で指定した文字列と置き換える文字列

//emlist[例][ruby]{
p 'a...
...二重にエスケープしなければなりません。

//emlist[ひとつめの括弧の内容に置き換えるときによくある間違い][ruby]{
p 'xbbb-xbbb'.gsub(/x(b+)/, "#{$1}") # => "-" # NG
p 'xbbb-xbbb'.gsub(/x(b+)/, "\1") # => "1-1" # NG
p 'xbbb-xbbb'.gsub(/x(b+)...
...バックスラッシュを倍にするときによくある間違い][ruby]{
puts
'\n'.gsub(/\\/, "\\\\") # => \n # NG
puts
'\n'.gsub(/\\/, '\\\\') # => \n # NG
puts
'\n'.gsub(/\\/, "\\\\\\\\") # => \\n # OK
puts
'\n'.gsub(/\\/, '\\\\\\\\') # => \\n # OK
//}

このような間違...

String#sub(pattern, replace) -> String (21215.0)

文字列中で pattern にマッチした最初の部分を 文字列 replace で置き換えた文字列を生成して返します。

...

@
param pattern 置き換える文字列のパターンを表す文字列か正規表現。
文字列を指定した場合は全く同じ文字列にだけマッチする
@
param replace pattern で指定した文字列と置き換える文字列

//emlist[例][ruby]{
p 'a...
...二重にエスケープしなければなりません。

//emlist[ひとつめの括弧の内容に置き換えるときによくある間違い][ruby]{
p 'xbbb-xbbb'.sub(/x(b+)/, "#{$1}") # => "-xbbb" # NG
p 'xbbb-xbbb'.sub(/x(b+)/, "\1") # => "1-xbbb" # NG
p 'xbbb-xbbb'.sub(/x(b+)/...
...t[バックスラッシュを倍にするときによくある間違い][ruby]{
puts
'\n'.sub(/\\/, "\\\\") # => \n # NG
puts
'\n'.sub(/\\/, '\\\\') # => \n # NG
puts
'\n'.sub(/\\/, "\\\\\\\\") # => \\n # OK
puts
'\n'.sub(/\\/, '\\\\\\\\') # => \\n # OK
//}

このような間違...
<< 1 2 3 ... > >>