るりまサーチ

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

別のキーワード

  1. bigdecimal/util to_d
  2. float to_d
  3. rsa d
  4. rsa d=
  5. matrix d

ライブラリ

クラス

キーワード

検索結果

<< 1 2 > >>

Shell::CommandProcessor#echo(*strings) -> Shell::Filter (21114.0)

実行すると, それらを内容とする Filter オブジェクトを返します.

...ings シェルコマンド echo に与える引数を文字列で指定します。

動作例
require 'shell'
Shell.def_system_command("head")
sh = Shell.new
sh.transact {
glob("*.txt").to_a.each { |file|
file.chomp!
cat(file).each { |l|
echo
(l) | tee(file + ".tee")...

ARGF.class#inplace_mode -> String | nil (6119.0)

c:ARGF#inplace で書き換えるファイルのバックアップに付加される拡 張子を返します。拡張子が設定されていない場合は空文字列を返します。イン プレースモードでない場合は nil を返します。

...ce_mode= で設定します。

例:
# $ echo "test" > test.txt
# $ ruby -i.bak test.rb test.txt
# $ cat test.txt # => "TEST"
# $ cat test.txt.bak # => "test"

# test.rb
ARGF.inplace_mode # => ".bak"
ARGF.each_line {|e|print e.upcase} # => "TEST"

例:
# $ echo "te...
...st" > test.txt
# $ ruby test.rb test.txt
# $ cat test.txt # => "test"

# test.rb
ARGF.inplace_mode # => nil
ARGF.each_line {|e|print e.upcase} # => "TEST"

@see d:spec/rubycmd#cmd_option, ARGF.class#inplace_mode=...

ARGF.class#closed? -> bool (6113.0)

現在開いている処理対象のファイルがARGFがcloseされていればtrueを返します。

...す。

例:
# $ echo "foo" > foo
# $ echo "bar" > bar
# $ ruby argf.rb foo bar

ARGF.filename # => "foo"
ARGF.close
# 複数のファイルを開いているので1度のARGF.closeではまた全てのファイルを閉じていないのでfalseになる
ARGF.closed? # => false
A...
...RGF.filename # => "bar"
ARGF.close
# 2つのファイルを開いていたので2度目のARGF.closeで全てのファイルを閉じたためtrueになる
ARGF.closed? # => true

@see IO#closed?, ARGF.class#close...

ARGF.class#each_codepoint -> Enumerator (6113.0)

self の各コードポイントに対して繰り返しブロックを呼びだします。

...は、Enumerator を返します。

例:
# $ echo "line1\n" > test1.txt
# $ echo "line2\n" > test2.txt
# $ ruby test.rb test1.txt test2.txt

# test.rb
ARGF.each_codepoint # => #<Enumerator: ARGF:each_codepoint>
ARGF.each_codepoint{|e|print e, ","} # => 108,105,110,101,4...

ARGF.class#each_codepoint { |c| ... } -> self (6113.0)

self の各コードポイントに対して繰り返しブロックを呼びだします。

...は、Enumerator を返します。

例:
# $ echo "line1\n" > test1.txt
# $ echo "line2\n" > test2.txt
# $ ruby test.rb test1.txt test2.txt

# test.rb
ARGF.each_codepoint # => #<Enumerator: ARGF:each_codepoint>
ARGF.each_codepoint{|e|print e, ","} # => 108,105,110,101,4...

絞り込み条件を変える

ARGF.class#read(length = nil, str = nil) -> String | nil (6113.0)

ARGVに指定されたファイルを先頭のファイルからlengthバイト読み込み、 その文字列をstrに出力します。読み込んだ文字列を返します。

...tr 出力先の文字列。内容は上書きされます。

$ echo "small" > small.txt
$ echo "large" > large.txt
$ ruby glark.rb small.txt large.txt

ARGF.read # => "small\nlarge"
ARGF.read(200) # => "small\nlarge"
ARGF.read(2) # => "sm"
ARGF.read(0) # => ""

@see IO#read...

ARGF.class#readbyte -> Integer (6107.0)

自身から 1 バイトを読み込み整数として返します。 既に EOF に達していれば EOFError が発生します。

...が発生します。

@raise EOFError 既に EOF に達している場合に発生します。

$ echo "foo" > file
$ ruby argf.rb file

ARGF.readbyte # => 102
ARGF.readbyte # => 111
ARGF.readbyte # => 111
ARGF.readbyte # => 10
ARGF.readbyte # => end of file reached (EOFError)...

ARGF.class#readchar -> String (6107.0)

ARGFから 1 文字読み込んで、その文字に対応する String を返します。EOF に 到達した時には EOFErrorを発生します。

...rorを発生します。

@raise EOFError EOFに達した時発生する

$ echo "foo" > file
$ ruby argf.rb file

ARGF.readchar # => "f"
ARGF.readchar # => "o"
ARGF.readchar # => "o"
ARGF.readchar # => "\n"
ARGF.readchar # => end of file reached (EOFError)

@see ARGF.class#getc...

Shell::CommandProcessor#cat(*files) -> Shell::Filter (3007.0)

実行すると, それらを内容とする Filter オブジェクトを返します.

...ファイル名を文字列で指定します。

動作例
require 'shell'
Shell.def_system_command("head")
sh = Shell.new
sh.transact {
glob("*.txt").to_a.each { |file|
file.chomp!
cat(file).each { |l|
echo
(l) | tee(file + ".tee") >> "all.tee"
}
}
}...

Shell::CommandProcessor#glob(pattern) -> Shell::Filter (3007.0)

実行すると, それらを内容とする Filter オブジェクトを返します.

...Dir.[] を参照してください。

動作例
require 'shell'
Shell.def_system_command("head")
sh = Shell.new
sh.transact {
glob("*.txt").to_a.each { |file|
file.chomp!
cat(file).each { |l|
echo
(l) | tee(file + ".tee") >> "all.tee"
}
}
}

@see Dir.[]...

絞り込み条件を変える

<< 1 2 > >>