るりまサーチ

最速Rubyリファレンスマニュアル検索!
414件ヒット [1-100件を表示] (0.062秒)
トップページ > クエリ:|[x] > クエリ:-[x] > クエリ:lineno[x]

別のキーワード

  1. _builtin |
  2. set |
  3. ipaddr |
  4. nilclass |
  5. integer |

ライブラリ

クラス

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

Ripper#lineno -> Integer | nil (18308.0)

現在のトークンの行番号を 1 から始まる数値で返します。

...現在のトークンの行番号を 1 から始まる数値で返します。

このメソッドはイベントハンドラの中でのみ意味のある値を返します。イベン
トハンドラの中で self.lineno を実行してください。...

Ripper::Filter#lineno -> Integer | nil (18308.0)

現在のトークンの行番号を 1 から始まる数値で返します。

...現在のトークンの行番号を 1 から始まる数値で返します。

このメソッドはイベントハンドラの中でのみ意味のある値を返します。イベン
トハンドラの中で self.lineno を実行してください。...

Zlib::GzipReader#lineno -> Integer (18253.0)

IO クラスの同名メソッドIO#linenoと同じです。

...IO クラスの同名メソッドIO#linenoと同じです。

但し、gzip ファイル中に
エラーがあった場合 Zlib::Error 例外や
Zlib::GzipFile::Error 例外が発生します。

gzip ファイルのフッターの処理に注意して下さい。
gzip ファイルのフッターに...
...lib::GzipWriter.open('hoge.gz') { |gz|
gz.puts 'h'
gz.puts 'o'
gz.puts 'g'
gz.puts 'e'
}
=end

Zlib::GzipReader.open('hoge.gz') { |gz|
while l = gz.gets
l.chomp!
printf "%s %d\n", l, gz.lineno
end
}
#=> h 1
#=> o 2
#=> g 3
#=> e 4

@see IO#lineno...

TracePoint#lineno -> Integer (18219.0)

発生したイベントの行番号を返します。

...発生したイベントの行番号を返します。

@raise RuntimeError イベントフックの外側で実行した場合に発生します。

//emlist[例][ruby]{
def foo(ret)
ret
end
trace = TracePoint.new(:call, :return) do |tp|
tp.lineno
end
trace.enable
foo 1
# => 1
# 3
//}...

ruby 1.9 feature (1986.0)

ruby 1.9 feature ruby version 1.9.0 は開発版です。 以下にあげる機能は将来削除されたり互換性のない仕様変更がなされるかもしれません。 1.9.1 以降は安定版です。 バグ修正がメインになります。

...w]: 追加されたクラス/メソッドなど
* [compat]: 変更されたクラス/メソッドなど(互換性のある変更) (only backward-compatibility) (影響の範囲が小さいと思われる変更もこちら)
* [change]: 変更されたクラス/メソッドなど(互換性...
...((<ruby-list:40865>))

=== 2005-06-08
: Array#nitems [compat]

Array#nitems にブロックを渡せるようになり、ブロックが真になる要素の個数を返すように
なりました。

[1,2,3].nitems{|i| i % 2 != 0} #=> 2

((<ruby-talk:134083>))

=== 2005-06-02
: proc...
...uf]) [lib][new]

追加 ((<ruby-dev:24070>))

=== 2004-09-13

: ripper [new]

追加 ((<ruby-dev:24255>))

=== 2004-08-27

: StringIO#readpartial(maxlen[, outbuf]) [lib][new]

追加。((<ruby-dev:24061>))

=== 2004-08-19

: Binding#eval(expr[, fname[, lineno=1]]) [new]

追加。((<...

絞り込み条件を変える

irb (282.0)

irb は Interactive Ruby の略です。 irb を使うと、Ruby の式を標準入力から簡単に入力・実行することができます。

...ons:
-
f ~/.irbrc を読み込まない
-
m bc モード (分数と行列の計算ができる)
-
d $DEBUG を true にする (ruby -d と同じ)
-
w ruby -w と同じ
-
W[level=2] ruby -W と同じ
-
r library ruby -r...
...設定をまとめて設定することができます。

以下に例を示します。

$ irb
irb(main):001:0> IRB.conf[:IRB_RC] = lambda {|conf| conf.prompt_i = "> " }
=> #<Proc:0x00002a95fa3fd8@(irb):2>
irb(main):002:0> irb
>

=== irb の使用例

irb のいろいろな使用例を...
...:0> _
=> 4294967296
irb(main):004:0> _ - 2**31
=> 2147483648
irb(main):005:0>
//}

: __

実行結果の履歴です。
__[lineno] で、lineno 行で実行した結果を得られます。
lineno
が負の時は、最新の結果から -lineno 行だけ前の
結果を得られま...
...s:
-
f ~/.irbrc を読み込まない
-
d $DEBUG を true にする (ruby -d と同じ)
-
w ruby -w と同じ
-
W[level=2] ruby -W と同じ
-
r library ruby -r と同じ
-
I ruby -I と同じ
-
U ruby -U...

IO#each(limit, chomp: false) {|line| ... } -> self (260.0)

IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。

...][ruby]{
IO.write("testfile", "This is line one,\nThis is line two,\nThis is line three,\nAnd so on...")
f = File.new("testfile")
f.each { |line| p "#{f.lineno}: #{line}" }
# => "1: This is line one,\n"
# "2: This is line two,\n"
# "3: This is line three,\n"
# "4: And so on..."
//}
//emlist[例: 行...
...[ruby]{
IO.write("testfile", "This is line one,This is line two,This is line three,And so on...")
f = File.new("testfile")
f.each(",", 10) { |line| p "#{f.lineno}: #{line}" }
# => "0: This is li"
# "1: ne one,"
# "1: This is li"
# "2: ne two,"
# "2: This is li"
# "3: ne three,"
# "3: And so on."
# "...
...uby]{
IO.write("testfile", "This is line one\nThis is line two\nThis is line three\nAnd so on...")
f = File.new("testfile")
f.each(chomp: true) { |line| p "#{f.lineno}: #{line}" }
# => "1: This is line one"
# "2: This is line two"
# "3: This is line three"
# "4: And so on..."
//}

@see $/, IO#gets...

IO#each(rs = $/, chomp: false) {|line| ... } -> self (260.0)

IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。

...][ruby]{
IO.write("testfile", "This is line one,\nThis is line two,\nThis is line three,\nAnd so on...")
f = File.new("testfile")
f.each { |line| p "#{f.lineno}: #{line}" }
# => "1: This is line one,\n"
# "2: This is line two,\n"
# "3: This is line three,\n"
# "4: And so on..."
//}
//emlist[例: 行...
...[ruby]{
IO.write("testfile", "This is line one,This is line two,This is line three,And so on...")
f = File.new("testfile")
f.each(",", 10) { |line| p "#{f.lineno}: #{line}" }
# => "0: This is li"
# "1: ne one,"
# "1: This is li"
# "2: ne two,"
# "2: This is li"
# "3: ne three,"
# "3: And so on."
# "...
...uby]{
IO.write("testfile", "This is line one\nThis is line two\nThis is line three\nAnd so on...")
f = File.new("testfile")
f.each(chomp: true) { |line| p "#{f.lineno}: #{line}" }
# => "1: This is line one"
# "2: This is line two"
# "3: This is line three"
# "4: And so on..."
//}

@see $/, IO#gets...

IO#each(rs, limit, chomp: false) {|line| ... } -> self (260.0)

IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。

...][ruby]{
IO.write("testfile", "This is line one,\nThis is line two,\nThis is line three,\nAnd so on...")
f = File.new("testfile")
f.each { |line| p "#{f.lineno}: #{line}" }
# => "1: This is line one,\n"
# "2: This is line two,\n"
# "3: This is line three,\n"
# "4: And so on..."
//}
//emlist[例: 行...
...[ruby]{
IO.write("testfile", "This is line one,This is line two,This is line three,And so on...")
f = File.new("testfile")
f.each(",", 10) { |line| p "#{f.lineno}: #{line}" }
# => "0: This is li"
# "1: ne one,"
# "1: This is li"
# "2: ne two,"
# "2: This is li"
# "3: ne three,"
# "3: And so on."
# "...
...uby]{
IO.write("testfile", "This is line one\nThis is line two\nThis is line three\nAnd so on...")
f = File.new("testfile")
f.each(chomp: true) { |line| p "#{f.lineno}: #{line}" }
# => "1: This is line one"
# "2: This is line two"
# "3: This is line three"
# "4: And so on..."
//}

@see $/, IO#gets...

IO#each_line(limit, chomp: false) {|line| ... } -> self (260.0)

IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。

...][ruby]{
IO.write("testfile", "This is line one,\nThis is line two,\nThis is line three,\nAnd so on...")
f = File.new("testfile")
f.each { |line| p "#{f.lineno}: #{line}" }
# => "1: This is line one,\n"
# "2: This is line two,\n"
# "3: This is line three,\n"
# "4: And so on..."
//}
//emlist[例: 行...
...[ruby]{
IO.write("testfile", "This is line one,This is line two,This is line three,And so on...")
f = File.new("testfile")
f.each(",", 10) { |line| p "#{f.lineno}: #{line}" }
# => "0: This is li"
# "1: ne one,"
# "1: This is li"
# "2: ne two,"
# "2: This is li"
# "3: ne three,"
# "3: And so on."
# "...
...uby]{
IO.write("testfile", "This is line one\nThis is line two\nThis is line three\nAnd so on...")
f = File.new("testfile")
f.each(chomp: true) { |line| p "#{f.lineno}: #{line}" }
# => "1: This is line one"
# "2: This is line two"
# "3: This is line three"
# "4: And so on..."
//}

@see $/, IO#gets...

絞り込み条件を変える

IO#each_line(rs = $/, chomp: false) {|line| ... } -> self (260.0)

IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。

...][ruby]{
IO.write("testfile", "This is line one,\nThis is line two,\nThis is line three,\nAnd so on...")
f = File.new("testfile")
f.each { |line| p "#{f.lineno}: #{line}" }
# => "1: This is line one,\n"
# "2: This is line two,\n"
# "3: This is line three,\n"
# "4: And so on..."
//}
//emlist[例: 行...
...[ruby]{
IO.write("testfile", "This is line one,This is line two,This is line three,And so on...")
f = File.new("testfile")
f.each(",", 10) { |line| p "#{f.lineno}: #{line}" }
# => "0: This is li"
# "1: ne one,"
# "1: This is li"
# "2: ne two,"
# "2: This is li"
# "3: ne three,"
# "3: And so on."
# "...
...uby]{
IO.write("testfile", "This is line one\nThis is line two\nThis is line three\nAnd so on...")
f = File.new("testfile")
f.each(chomp: true) { |line| p "#{f.lineno}: #{line}" }
# => "1: This is line one"
# "2: This is line two"
# "3: This is line three"
# "4: And so on..."
//}

@see $/, IO#gets...
<< 1 2 3 ... > >>