るりまサーチ

最速Rubyリファレンスマニュアル検索!
29718件ヒット [1-100件を表示] (0.094秒)
トップページ > クエリ:Ruby[x] > 種類:インスタンスメソッド[x]

別のキーワード

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

クラス

キーワード

検索結果

<< 1 2 3 ... > >>

RubyVM::InstructionSequence#to_a -> Array (23013.0)

self の情報を 14 要素の配列にして返します。

...命令シーケンスを構成する命令とオペランドの配列の配列。


//emlist[例][ruby]{
require 'pp'

iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
pp iseq.to_a
# ※ Ruby 2.5.0 での実行結果
# => ["YARVInstructionSequence/SimpleDataFormat",
# 2,
# 0,
# 1,
# {:arg_...

RubyVM::InstructionSequence#to_binary(extra_data = nil) -> String (23013.0)

バイナリフォーマットでシリアライズされたiseqのデータを文字列として返します。 RubyVM::InstructionSequence.load_from_binary メソッドでバイナリデータに対応するiseqオブジェクトを作れます。

...タを文字列として返します。
Ruby
VM::InstructionSequence.load_from_binary メソッドでバイナリデータに対応するiseqオブジェクトを作れます。

引数の extra_data はバイナリデータと共に保存されます。
Ruby
VM::InstructionSequence.load_from_binary_e...
...は他のマシンに移動できません。他のバージョンや他のアーキテクチャのRubyで作られたバイナリデータは使用できません。

//emlist[例][ruby]{
iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
iseq.to_binary("extra_data")

# ※表示の都合上...
...0\x00numE\x7F\x00\x00\x02\x00\x00\x00\x00
# \x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00+\xA0\x01\x00\x00\xAC\x01\x00
# \x00\xCA\x01\x00\x00\xD6\x01\x00\x00\xED\x01\x00\x00extra_data"
//}

@see RubyVM::InstructionSequence.load_from_binary
@see RubyVM::InstructionSequence.load_from_binary_extra_data...

RubyVM::AbstractSyntaxTree::Node#children -> Array (23007.0)

self の子ノードを配列で返します。

...type によって異なります。

戻り値は、ほかの RubyVM::AbstractSyntaxTree::Node のインスタンスや nil を含みます。

//emlist[][ruby]{
node = RubyVM::AbstractSyntaxTree.parse('1 + 2')
p node.children
# => [[], nil, #<RubyVM::AbstractSyntaxTree::Node:OPCALL@1:0-1:5>]
//}...

RubyVM::AbstractSyntaxTree::Node#first_column -> Integer (23007.0)

ソースコード中で、self を表すテキストが最初に現れる列番号を返します。

...ソースコード中で、self を表すテキストが最初に現れる列番号を返します。

列番号は0-originで、バイト単位で表されます。

//emlist[][ruby]{
node = RubyVM::AbstractSyntaxTree.parse('1 + 2')
p node.first_column # => 0
//}...

RubyVM::AbstractSyntaxTree::Node#first_lineno -> Integer (23007.0)

ソースコード中で、self を表すテキストが最初に現れる行番号を返します。

...ソースコード中で、self を表すテキストが最初に現れる行番号を返します。

行番号は1-originです。

//emlist[][ruby]{
node = RubyVM::AbstractSyntaxTree.parse('1 + 2')
p node.first_lineno # => 1
//}...

絞り込み条件を変える

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

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

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

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

RubyVM::AbstractSyntaxTree::Node#last_column -> Integer (23007.0)

ソースコード中で、self を表すテキストが最後に現れる列番号を返します。

...ソースコード中で、self を表すテキストが最後に現れる列番号を返します。

列番号は0-originで、バイト単位で表されます。

//emlist[][ruby]{
node = RubyVM::AbstractSyntaxTree.parse('1 + 1')
p node.last_column # => 5
//}...

RubyVM::AbstractSyntaxTree::Node#last_lineno -> Integer (23007.0)

ソースコード中で、self を表すテキストが最後に現れる行番号を返します。

...ソースコード中で、self を表すテキストが最後に現れる行番号を返します。

行番号は1-originです。

//emlist[][ruby]{
node = RubyVM::AbstractSyntaxTree.parse('1 + 1')
p node.last_lineno # => 1
//}...

RubyVM::AbstractSyntaxTree::Node#type -> Symbol (23007.0)

self の種類を Symbol で返します。

...self の種類を Symbol で返します。

//emlist[][ruby]{
node = RubyVM::AbstractSyntaxTree.parse('1 + 1')
p node.type # => :SCOPE
//}...

RubyVM::InstructionSequence#inspect -> String (23007.0)

self の情報をラベルとパスを含んだ人間に読みやすい文字列にして返します。

...んだ人間に読みやすい文字列にして返します。

//emlist[例][ruby]{
iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
iseq.inspect # => "<RubyVM::InstructionSequence:<compiled>@<compiled>>"
//}

@see RubyVM::InstructionSequence#label,
Ruby
VM::InstructionSequence#path...

絞り込み条件を変える

RubyVM::InstructionSequence#absolute_path -> String | nil (23001.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#base_label -> String (23001.0)

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

...ラベルを返します。

例1:irb で実行した場合

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

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

# /tmp/me...
...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#l...
<< 1 2 3 ... > >>