るりまサーチ

最速Rubyリファレンスマニュアル検索!
81件ヒット [1-81件を表示] (0.013秒)
トップページ > クエリ:line=[x] > 種類:モジュール関数[x]

別のキーワード

  1. _builtin each_line
  2. io each_line
  3. tracer set_get_line_procs
  4. stringio each_line
  5. pathname each_line

ライブラリ

モジュール

キーワード

検索結果

Kernel.#caller(range) -> [String] | nil (7.0)

start 段上の呼び出し元の情報を $@ の形式のバックトレース(文字列の配列)として返します。

...ソッド名]
を取り出して返します。

//emlist[例][ruby]{
def parse_caller(at)
if /^(.+?):(\d+)(?::in `(.*)')?/ =~ at
file = $1
line =
$2.to_i
method = $3
[file, line, method]
end
end

def foo
p parse_caller(caller.first)
end

def bar
foo
p parse_caller(caller.f...

Kernel.#caller(start = 1) -> [String] | nil (7.0)

start 段上の呼び出し元の情報を $@ の形式のバックトレース(文字列の配列)として返します。

...ソッド名]
を取り出して返します。

//emlist[例][ruby]{
def parse_caller(at)
if /^(.+?):(\d+)(?::in `(.*)')?/ =~ at
file = $1
line =
$2.to_i
method = $3
[file, line, method]
end
end

def foo
p parse_caller(caller.first)
end

def bar
foo
p parse_caller(caller.f...

Kernel.#caller(start, length) -> [String] | nil (7.0)

start 段上の呼び出し元の情報を $@ の形式のバックトレース(文字列の配列)として返します。

...ソッド名]
を取り出して返します。

//emlist[例][ruby]{
def parse_caller(at)
if /^(.+?):(\d+)(?::in `(.*)')?/ =~ at
file = $1
line =
$2.to_i
method = $3
[file, line, method]
end
end

def foo
p parse_caller(caller.first)
end

def bar
foo
p parse_caller(caller.f...

Kernel.#loop -> Enumerator (7.0)

(中断されない限り)永遠にブロックの評価を繰り返します。 ブロックが指定されなければ、代わりに Enumerator を返します。

...ロックが指定されなければ、代わりに Enumerator を返します。

//emlist[例][ruby]{
loop do
print "Input: "
line =
gets
break if !line or line =~ /^qQ/
# ...
end
//}

与えられたブロック内で StopIteration を Kernel.#raise すると
ループを終了して nil...
...ロックが指定されなければ、代わりに Enumerator を返します。

//emlist[例][ruby]{
loop do
print "Input: "
line =
gets
break if !line or line =~ /^qQ/
# ...
end
//}

与えられたブロック内で StopIteration を Kernel.#raise すると
ループを終了して Enum...

Kernel.#loop { ... } -> object | nil (7.0)

(中断されない限り)永遠にブロックの評価を繰り返します。 ブロックが指定されなければ、代わりに Enumerator を返します。

...ロックが指定されなければ、代わりに Enumerator を返します。

//emlist[例][ruby]{
loop do
print "Input: "
line =
gets
break if !line or line =~ /^qQ/
# ...
end
//}

与えられたブロック内で StopIteration を Kernel.#raise すると
ループを終了して nil...
...ロックが指定されなければ、代わりに Enumerator を返します。

//emlist[例][ruby]{
loop do
print "Input: "
line =
gets
break if !line or line =~ /^qQ/
# ...
end
//}

与えられたブロック内で StopIteration を Kernel.#raise すると
ループを終了して Enum...

絞り込み条件を変える

Timeout.#timeout(sec, exception_class = nil) {|i| ... } -> object (7.0)

ブロックを sec 秒の期限付きで実行します。 ブロックの実行時間が制限を過ぎたときは例外 Timeout::Error が発生します。

...out.timeout(t) {
# system だととまらない
# system("./loop.sh")
com = IO.popen("./loop.sh")
pid = com.pid
while line = com.gets
print line
end
}
rescue Timeout::Error => err
puts "timeout: shell execution."
Process.kill('SIGINT', pid)...

Timeout.#timeout(sec, exception_class, message) {|i| ... } -> object (7.0)

ブロックを sec 秒の期限付きで実行します。 ブロックの実行時間が制限を過ぎたときは例外 Timeout::Error が発生します。

...out.timeout(t) {
# system だととまらない
# system("./loop.sh")
com = IO.popen("./loop.sh")
pid = com.pid
while line = com.gets
print line
end
}
rescue Timeout::Error => err
puts "timeout: shell execution."
Process.kill('SIGINT', pid)...