るりまサーチ

最速Rubyリファレンスマニュアル検索!
17件ヒット [1-17件を表示] (0.137秒)
トップページ > ライブラリ:ビルトイン[x] > クエリ:p[x] > クエリ:E[x] > クエリ:first_lineno[x]

別のキーワード

  1. open3 popen2e
  2. socket af_e164
  3. matrix det_e
  4. matrix rank_e
  5. open3 capture2e

検索結果

RubyVM::InstructionSequence#first_lineno -> Integer (24221.0)

self が表す命令シーケンスの 1 行目の行番号を返します。

...self が表す命令シーケンスの 1 行目の行番号を返します。

例1:irb で実行した場合

RubyVM::InstructionSequence.compile('num = 1 + 2').first_lineno
# => 1

例2:

# /tmp/method.rb
require "foo-library"
def foo
p
:foo
e
nd

RubyVM::InstructionSequence.of(me...
...thod(:foo)).first_lineno
# => 2...

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

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

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

行番号は1-originです。

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