るりまサーチ

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

別のキーワード

  1. csv skip_blanks?
  2. strscan skip
  3. _builtin skip
  4. argf.class skip
  5. stringscanner skip

キーワード

検索結果

ARGF.class#skip -> self (18109.0)

現在開いている処理対象のファイルをクローズします。 次回の読み込みは次の引数が処理対象になります。 self を返します。

...いている処理対象のファイルをクローズします。
次回の読み込みは次の引数が処理対象になります。
self を返します。

$ echo "foo" > foo
$ echo "bar" > bar

$ ruby argf.rb foo bar
ARGF.filename # => "foo"
ARGF.skip
ARGF.filename # => "bar"...

Thread::Backtrace::Location (50.0)

Ruby のフレームを表すクラスです。

...

Kernel.#caller_locations から生成されます。

//emlist[例1][ruby]{
# caller_locations.rb
def a(skip)
caller_locations(skip)
end
def b(skip)
a(skip)
end
def c(skip)
b(skip)
end

c(0..2).map do |call|
puts call.to_s
end
//}

例1の実行結果:

caller_locations.rb:2:in `a'...
...b:5:in `b'
caller_locations.rb:8:in `c'

//emlist[例2][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end
end

Foo.new(0..2).locations.map do |call|
puts call.to_s
end
//}

例2の実行結果:

init.rb:4:in `initialize'...

Thread::Backtrace::Location#absolute_path -> String (14.0)

self が表すフレームの絶対パスを返します。

...レームの絶対パスを返します。

//emlist[例][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end
end

Foo.new(0..2).locations.map do |call|
puts call.absolute_path
end

# => /path/to/foo.rb
# /path/to/foo.rb
# /path...

Thread::Backtrace::Location#base_label -> String (14.0)

self が表すフレームの基本ラベルを返します。通常、 Thread::Backtrace::Location#label から修飾を取り除いたもので構成 されます。

...除いたもので構成
されます。

//emlist[例][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end
end

Foo.new(0..2).locations.map do |call|
puts call.base_label
end

# => initialize
# new
# <main>
//}

@see Thread::Ba...

Thread::Backtrace::Location#inspect -> String (14.0)

Thread::Backtrace::Location#to_s の結果を人間が読みやすいような文 字列に変換したオブジェクトを返します。

...したオブジェクトを返します。

//emlist[例][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end
end

Foo.new(0..2).locations.map do |call|
puts call.inspect
end

# => "path/to/foo.rb:5:in `initialize'"
# "path/to/f...

絞り込み条件を変える

Thread::Backtrace::Location#to_s -> String (14.0)

self が表すフレームを Kernel.#caller と同じ表現にした文字列を返し ます。

...現にした文字列を返し
ます。

//emlist[例][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end
end

Foo.new(0..2).locations.map do |call|
puts call.to_s
end

# => path/to/foo.rb:5:in `initialize'
# path/to/foo.rb:9:...

ARGF (8.0)

スクリプトに指定した引数 (Object::ARGV を参照) をファイル名とみなして、 それらのファイルを連結した 1 つの仮想ファイルを表すオブジェクトです。 ARGV が空なら標準入力を対象とします。 ARGV を変更すればこのオブジェクトの動作に影響します。

...mlist[][ruby]{
ARGV.replace %w(/tmp/foo /tmp/bar)
ARGF.each {|line|
# 処理中の ARGV の内容を表示
p [ARGF.filename, ARGV]
ARGF.skip
}
# => ["/tmp/foo", ["/tmp/bar"]]
# ["/tmp/bar", []]
# 最後まで読んだ後 (ARGV が空) の動作
p ARGF.gets # => nil
p ARGF...

ARGF.class#filename -> String (8.0)

現在開いている処理対象のファイル名を返します。

...は - を返します。
組み込み変数 $FILENAME と同じです。

$ echo "foo" > foo
$ echo "bar" > bar
$ echo "glark" > glark

$ ruby argf.rb foo bar glark

ARGF.filename # => "foo"
ARGF.read(5) # => "foo\nb"
ARGF.filename # => "bar"
ARGF.skip
ARGF.filename # => "glark"...

ARGF.class#path -> String (8.0)

現在開いている処理対象のファイル名を返します。

...は - を返します。
組み込み変数 $FILENAME と同じです。

$ echo "foo" > foo
$ echo "bar" > bar
$ echo "glark" > glark

$ ruby argf.rb foo bar glark

ARGF.filename # => "foo"
ARGF.read(5) # => "foo\nb"
ARGF.filename # => "bar"
ARGF.skip
ARGF.filename # => "glark"...