種類
- インスタンスメソッド (158)
- 特異メソッド (28)
- モジュール関数 (22)
- ライブラリ (11)
- クラス (11)
ライブラリ
- ビルトイン (140)
- open3 (22)
- shell (6)
-
shell
/ builtin-command (6) -
shell
/ command-processor (6) -
shell
/ filter (6) - socket (22)
-
webrick
/ httpstatus (11)
クラス
-
ARGF
. class (99) - Array (19)
- Shell (6)
-
Shell
:: CommandProcessor (6) -
Shell
:: Echo (6) -
Shell
:: Filter (6) - Socket (22)
- String (22)
モジュール
- Open3 (22)
キーワード
- MultipleChoices (11)
- capture2e (11)
- capture3 (11)
- chr (11)
- filename (11)
- getc (11)
- gets (33)
-
inplace
_ mode (11) - irb (11)
- new (6)
- pack (19)
-
pack
_ sockaddr _ in (11) - path (11)
- read (11)
- readchar (11)
-
sockaddr
_ in (11) - unpack (11)
検索結果
先頭5件
-
Shell
# echo(*strings) -> Shell :: Filter (18213.0) -
実行すると, それらを内容とする Filter オブジェクトを返します.
....
@param strings シェルコマンド 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(fi... -
Shell
:: CommandProcessor # echo(*strings) -> Shell :: Filter (18213.0) -
実行すると, それらを内容とする Filter オブジェクトを返します.
....
@param strings シェルコマンド 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(fi... -
Shell
:: Filter # echo(*strings) -> Shell :: Filter (18213.0) -
実行すると, それらを内容とする Filter オブジェクトを返します.
....
@param strings シェルコマンド 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(fi... -
WEBrick
:: HTTPStatus :: MultipleChoices (9000.0) -
HTTP のステータスコード 300 Multiple Choices を表すクラスです。
...HTTP のステータスコード 300 Multiple Choices を表すクラスです。... -
String
# chr -> String (3112.0) -
self の最初の文字だけを含む文字列を返します。
...値が Integer から String を返すように変更になりました。
Ruby 1.8 以前と1.9以降の互換性を保つために String#chr が存在します。
例:
# ruby 1.8 系では STDIN.getc が 116 を返すため Integer#chr が呼び出される
$ echo test | ruby -e "p STDIN.ge......tc.chr" # => "t"
# ruby 1.9 系以降では STDIN.getc が "t" を返すため String#chr が呼び出される
$ echo test | ruby -e "p STDIN.getc.chr" # => "t"
@see String#ord, Integer#chr... -
Shell
:: Echo . new(sh , *strings) (3100.0) -
@todo
@todo -
String
# unpack(template) -> Array (3006.0) -
Array#pack で生成された文字列を テンプレート文字列 template にしたがってアンパックし、 それらの要素を含む配列を返します。
...@param template pack テンプレート文字列
@return オブジェクトの配列
以下にあげるものは、Array#pack、String#unpack
のテンプレート文字の一覧です。テンプレート文字は後に「長さ」を表す数字
を続けることができます......<: little endian signed long
//}
=== 各テンプレート文字の説明
説明中、Array#pack と String#unpack で違いのあるものは `/' で区切って
「Array#pack の説明 / String#unpack の説明」としています。
: a
ASCII文字列(ヌル文字を詰める/後続する......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 を使う代わりに......m template pack テンプレート文字列
@return オブジェクトの配列
以下にあげるものは、Array#pack、String#unpack、String#unpack1
のテンプレート文字の一覧です。テンプレート文字は後に「長さ」を表す数字
を続けることがで... -
Array
# pack(template , buffer: String . new) -> String (206.0) -
配列の内容を template で指定された文字列にしたがって、 バイナリとしてパックした文字列を返します。
...指定した場合は返値も指定した文字列オブジェクトになります。
以下にあげるものは、Array#pack、String#unpack、String#unpack1
のテンプレート文字の一覧です。テンプレート文字は後に「長さ」を表す数字
を続けることがで......<: little endian signed long
//}
=== 各テンプレート文字の説明
説明中、Array#pack と String#unpack で違いのあるものは `/' で区切って
「Array#pack の説明 / String#unpack の説明」としています。
: a
ASCII文字列(ヌル文字を詰める/後続する......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 を使う代わりに... -
Open3
. # capture3(*cmd) -> [String , String , Process :: Status] (206.0) -
cmdで指定されたコマンドを実行し、そのプロセスの標準出力と標準エラー、プ ロセスの終了ステータスを表すオブジェクトを返します。
...されると内部で使用される
パイプをバイナリモードに指定します。
例:
require "open3"
o, e, s = Open3.capture3("echo a; sort >&2", :stdin_data=>"foo\nbar\nbaz\n")
p o #=> "a\n"
p e #=> "bar\nbaz\nfoo\n"
p s #=> #<Process::Status: pid 32682 exit 0>
Open3.#po... -
ARGF
. class # gets(limit) -> String | nil (124.0) -
ARGFの現在位置から一行ずつ文字列として読み込みます。EOF に到達した時に は nil を返します。
...# $ echo "line1\nline2\nline3\n\nline4\n" > test.txt
# $ ruby test.rb test.txt
# test.rb
ARGF.gets # => "line1\n"
例:
# $ echo "line1\nline2\nline3\n\nline4\n" > test.txt
# $ ruby test.rb test.txt
# test.rb
ARGF.gets(2) # => "li"
例:
# $ echo "......line1\nline2\nline3\n\nline4\n" > test.txt
# $ ruby test.rb test.txt
# test.rb
ARGF.gets("e") # => "line"
例:
# $ echo "line1\nline2\nline3\n\nline4\n" > test.txt
# $ ruby test.rb test.txt
# test.rb
ARGF.gets("") # => "line1\nline2\nline3\n\n"
@s... -
ARGF
. class # gets(limit , chomp: false) -> String | nil (124.0) -
ARGFの現在位置から一行ずつ文字列として読み込みます。EOF に到達した時に は nil を返します。
...# $ echo "line1\nline2\nline3\n\nline4\n" > test.txt
# $ ruby test.rb test.txt
# test.rb
ARGF.gets # => "line1\n"
例:
# $ echo "line1\nline2\nline3\n\nline4\n" > test.txt
# $ ruby test.rb test.txt
# test.rb
ARGF.gets(2) # => "li"
例:
# $ echo "......line1\nline2\nline3\n\nline4\n" > test.txt
# $ ruby test.rb test.txt
# test.rb
ARGF.gets("e") # => "line"
例:
# $ echo "line1\nline2\nline3\n\nline4\n" > test.txt
# $ ruby test.rb test.txt
# test.rb
ARGF.gets("") # => "line1\nline2\nline3\n\n"
@s... -
ARGF
. class # gets(rs = $ / ) -> String | nil (124.0) -
ARGFの現在位置から一行ずつ文字列として読み込みます。EOF に到達した時に は nil を返します。
...# $ echo "line1\nline2\nline3\n\nline4\n" > test.txt
# $ ruby test.rb test.txt
# test.rb
ARGF.gets # => "line1\n"
例:
# $ echo "line1\nline2\nline3\n\nline4\n" > test.txt
# $ ruby test.rb test.txt
# test.rb
ARGF.gets(2) # => "li"
例:
# $ echo "......line1\nline2\nline3\n\nline4\n" > test.txt
# $ ruby test.rb test.txt
# test.rb
ARGF.gets("e") # => "line"
例:
# $ echo "line1\nline2\nline3\n\nline4\n" > test.txt
# $ ruby test.rb test.txt
# test.rb
ARGF.gets("") # => "line1\nline2\nline3\n\n"
@s... -
ARGF
. class # gets(rs = $ / , chomp: false) -> String | nil (124.0) -
ARGFの現在位置から一行ずつ文字列として読み込みます。EOF に到達した時に は nil を返します。
...# $ echo "line1\nline2\nline3\n\nline4\n" > test.txt
# $ ruby test.rb test.txt
# test.rb
ARGF.gets # => "line1\n"
例:
# $ echo "line1\nline2\nline3\n\nline4\n" > test.txt
# $ ruby test.rb test.txt
# test.rb
ARGF.gets(2) # => "li"
例:
# $ echo "......line1\nline2\nline3\n\nline4\n" > test.txt
# $ ruby test.rb test.txt
# test.rb
ARGF.gets("e") # => "line"
例:
# $ echo "line1\nline2\nline3\n\nline4\n" > test.txt
# $ ruby test.rb test.txt
# test.rb
ARGF.gets("") # => "line1\nline2\nline3\n\n"
@s... -
ARGF
. class # gets(rs , limit) -> String | nil (124.0) -
ARGFの現在位置から一行ずつ文字列として読み込みます。EOF に到達した時に は nil を返します。
...# $ echo "line1\nline2\nline3\n\nline4\n" > test.txt
# $ ruby test.rb test.txt
# test.rb
ARGF.gets # => "line1\n"
例:
# $ echo "line1\nline2\nline3\n\nline4\n" > test.txt
# $ ruby test.rb test.txt
# test.rb
ARGF.gets(2) # => "li"
例:
# $ echo "......line1\nline2\nline3\n\nline4\n" > test.txt
# $ ruby test.rb test.txt
# test.rb
ARGF.gets("e") # => "line"
例:
# $ echo "line1\nline2\nline3\n\nline4\n" > test.txt
# $ ruby test.rb test.txt
# test.rb
ARGF.gets("") # => "line1\nline2\nline3\n\n"
@s...