258件ヒット
[201-258件を表示]
(0.058秒)
種類
- 変数 (96)
- 定数 (72)
- インスタンスメソッド (36)
- 特異メソッド (30)
- 文書 (24)
ライブラリ
クラス
- CGI (12)
- CSV (12)
- File (60)
- OptionParser (12)
- Pathname (12)
- Shell (12)
-
Shell
:: Filter (6)
モジュール
- Enumerable (12)
- Kernel (96)
キーワード
-
$ FIELD _ SEPARATOR (12) -
$ FS (12) -
$ INPUT _ RECORD _ SEPARATOR (12) -
$ OFS (12) -
$ ORS (12) -
$ OUTPUT _ FIELD _ SEPARATOR (12) -
$ OUTPUT _ RECORD _ SEPARATOR (12) -
$ RS (12) -
ALT
_ SEPARATOR (12) -
PATH
_ SEPARATOR (24) - SEPARATOR (12)
-
SEPARATOR
_ PAT (12) - Separator (12)
- chunk (12)
-
default
_ record _ separator (6) - each (6)
- join (12)
- new (12)
-
record
_ separator (6) -
ruby 1
. 6 feature (12) - 正規表現 (12)
検索結果
先頭5件
-
Enumerable
# chunk {|elt| . . . } -> Enumerator (172.0) -
要素を前から順にブロックで評価し、その結果によって 要素をチャンクに分けた(グループ化した)要素を持つ Enumerator を返します。
...st[例][ruby]{
# ファイルのエンコーディングは実際のファイルに合わせてください。
open("/usr/share/dict/words", "r:iso-8859-1") {|f|
f.chunk {|line| line[0].upcase }.each {|ch, lines| p [ch, lines.length] }
}
# => ["A", 17096]
# ["B", 11070]
# ["C", 19901]
# [......", 10896]
# ...
//}
さらにこのメソッドは以下の値を特別扱いします。
* ブロックの評価値が nil もしくは :_separator であった場合、
その要素を捨てます。チャンクはこの前後で区切られます。
* ブロックの評価値 :_alone......返すのみで例外は発生しない
//}
nil、 :_separator はある要素を無視したい場合に用います。
例として svn log の出力のハイフンの所で区切りたい場合を考えます。
//emlist[例][ruby]{
sep = "-"*72 + "\n" # ハイフンが72個の行
IO.popen("svn... -
File
. join(*item) -> String (144.0) -
File::SEPARATORを間に入れて文字列を連結します。platform/DOSISH-supportで環境依存になる予定です。
...File::SEPARATORを間に入れて文字列を連結します。platform/DOSISH-supportで環境依存になる予定です。
@param item 連結したいディレクトリ名やファイル名を文字列(もしくは文字列を要素に持つ配列)で与えます。
文字列A......とBを連結する際に、Aの末尾の文字とBの先頭の文字がFile::SEPARATORであった場合には、
まずこれらを削除した上で改めてFile::SEPARATORを間に入れて連結します。
引数の中に配列がある場合は配列要素を再帰的... -
CSV
. new(data , options = Hash . new) -> CSV (124.0) -
このメソッドは CSV ファイルを読み込んだり、書き出したりするために String か IO のインスタンスをラップします。
...r output, the default
$INPUT_RECORD_SEPARATOR ($/) is used. Obviously,
discovery takes a little time. Set manually if speed is important. Also
note that IO objects should be opened in binary mode on Windows if this
feature will be used as the line-ending translation can cause
proble......が一つだけ
の場合は配列に格納する必要はありません。
全ての組み込みの変換器は、値を変換する前に UTF-8 にエンコーディング変
換を試みます。エンコーディング変換に失敗した場合はフィールドは変換さ
れませ......ョンに似ていますが、ヘッダ専用の変換器を定義します。
全ての組み込みの変換器は、値を変換する前に UTF-8 にエンコーディング変
換を試みます。エンコーディング変換に失敗した場合はヘッダは変換されま
せん。
:... -
Kernel
$ $ OFS -> String | nil (107.0) -
$, の別名
...$, の別名
require "English"
array = %w|hoge fuga ugo bar foo|
p array.join #=> "hogefugaugobarfoo"
$OUTPUT_FIELD_SEPARATOR = ","
p array.join #=> "hoge,fuga,ugo,bar,foo"... -
Kernel
$ $ ORS -> String | nil (107.0) -
$\ の別名
...$\ の別名
require "English"
print "hoge\nhuga\n"
$OUTPUT_RECORD_SEPARATOR = "\n"
print "fuge"
print "ugo"
# end of sample.rb
ruby sample.rb
hoge
huga
fuge
ugo... -
Shell
:: Filter # each(rs = nil) -> () (106.0) -
フィルタの一行ずつをblockに渡します。
...行ずつをblockに渡します。
@param rs レコードセパレーターを表す文字列を指定します。
nil ならば、Shell.record_separatorの値が使用されます。
使用例
require 'shell'
sh = Shell.new
sh.cat("/etc/passwd").each { |line|
puts line
}...