195件ヒット
[1-100件を表示]
(0.023秒)
種類
- インスタンスメソッド (171)
- 文書 (24)
ライブラリ
- ビルトイン (93)
- shell (24)
-
shell
/ builtin-command (6) -
shell
/ command-processor (24) -
shell
/ filter (24)
クラス
-
ARGF
. class (60) - Array (21)
- Shell (24)
-
Shell
:: CommandProcessor (24) -
Shell
:: Echo (6) -
Shell
:: Filter (24) - String (12)
キーワード
- cat (18)
-
each
_ char (24) -
each
_ codepoint (24) - glob (18)
-
inplace
_ mode (12) - pack (21)
- pack テンプレート文字列 (12)
-
ruby 1
. 6 feature (12) - tee (18)
- unpack (12)
検索結果
先頭5件
-
Shell
:: Echo # each(rs = nil) {|str| . . . } (21101.0) -
@todo
@todo -
Shell
# echo(*strings) -> Shell :: Filter (18125.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")... -
Shell
:: CommandProcessor # echo(*strings) -> Shell :: Filter (18125.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")... -
Shell
:: Filter # echo(*strings) -> Shell :: Filter (18125.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 # each _ char -> Enumerator (6138.0) -
レシーバに含まれる文字を一文字ずつブロックに渡して評価します。
...ブジェクトを生成し
て返します。
例:
# $ echo "line1\n" > test1.txt
# $ echo "line2\n" > test2.txt
# $ ruby test.rb test1.txt test2.txt
# test.rb
ARGF.each_char # => #<Enumerator: ARGF:each_char>
ARGF.each_char{|e|p e}
# => "l"
# "i"
# "n"
# "e......"
# "1"
# "\n"
# "l"
# "i"
# "n"
# "e"
# "2"
# "\n"
@see IO#each_char... -
ARGF
. class # each _ char { |c| . . . } -> self (6138.0) -
レシーバに含まれる文字を一文字ずつブロックに渡して評価します。
...ブジェクトを生成し
て返します。
例:
# $ echo "line1\n" > test1.txt
# $ echo "line2\n" > test2.txt
# $ ruby test.rb test1.txt test2.txt
# test.rb
ARGF.each_char # => #<Enumerator: ARGF:each_char>
ARGF.each_char{|e|p e}
# => "l"
# "i"
# "n"
# "e......"
# "1"
# "\n"
# "l"
# "i"
# "n"
# "e"
# "2"
# "\n"
@see IO#each_char... -
ARGF
. class # each _ codepoint -> Enumerator (6132.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 (6132.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... -
ruby 1
. 6 feature (54.0) -
ruby 1.6 feature ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン になります。
...2002-03-10 メソッドの戻り値
以下のメソッドの戻り値が正しくなりました。((<ruby-bugs-ja:PR#205>))
* ((<Enumerable/each_with_index>)) が self を返すようになった(以前は nil)
* ((<Process/Process.setpgrp>)) が返す値が不定だった。
* ((<String......返すようになった(以前は false)
* IO#close がクローズ済みな IO に対して IOError を起こすようになった。
* IO#each_byte が self を返すようになった(以前は nil)
: rb_define_module_under()
C 関数 rb_define_module_under() でモジュールを定......るファイル名を指定したとき、拡張子がついてな
いとロードできなくなっていました。((<ruby-dev:13756>))
$ echo p __FILE__ > ~/a.rb
$ ruby17 -v -r~/a -e0
ruby 1.7.1 (2001-07-03) [i686-linux]
0: No such file to load -- ~/a (LoadError)
$ ruby16... -
ARGF
. class # inplace _ mode -> String | nil (24.0) -
c:ARGF#inplace で書き換えるファイルのバックアップに付加される拡 張子を返します。拡張子が設定されていない場合は空文字列を返します。イン プレースモードでない場合は nil を返します。
...ます。
例:
# $ 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 "test" > 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=... -
Array
# pack(template) -> String (18.0) -
配列の内容を template で指定された文字列にしたがって、 バイナリとしてパックした文字列を返します。
...121].pack("cccc") # => "Ruby"
[82, 117, 98, 121].pack("c4") # => "Ruby"
[82, 117, 98, 121].pack("c*") # => "Ruby"
s = ""
[82, 117, 98, 121].each {|c| s << c}
s # => "Ruby"
[82, 117, 98, 121].collect {|c| sprintf "%c", c}.join # => "Ruby"
[82, 117, 98, 121].inject("") {|s, c| s << c}......}
: 文字列を数値(文字コード)の配列に変換する例
//emlist[][ruby]{
"Ruby".unpack('C*') # => [82, 117, 98, 121]
a = []
"Ruby".each_byte {|c| a << c}
a # => [82, 117, 98, 121]
//}
: "x" でヌルバイトを埋めることができる
//emlist[][ruby]{
[82, 117, 98, 121].pac......c.to_i}.pack("C4")
# => "\x7F\x00\x00\x01"
//}
: sockaddr_in 構造体
//emlist[][ruby]{
require 'socket'
[Socket::AF_INET,
Socket.getservbyname('echo'),
127, 0, 0, 1].pack("s n C4 x8")
# => "\x02\x00\x00\a\x7F\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00"
//}
pack/unpack を使う代わりに...