種類
- モジュール関数 (24)
- インスタンスメソッド (24)
- 文書 (22)
- クラス (12)
- ライブラリ (12)
クラス
- IO (24)
モジュール
- Open3 (24)
キーワード
-
NEWS for Ruby 2
. 3 . 0 (10) - TCPServer (12)
- eof? (12)
- irb (12)
-
pipeline
_ rw (24) -
ruby 1
. 8 . 4 feature (12)
検索結果
先頭5件
-
IO
# eof -> bool (18150.0) -
ストリームがファイルの終端に達した場合、true を返します。そうでない場合、false を返します。
...file")
dummy = f.readlines
f.eof #=> true
自身がパイプやソケットなどのストリームであった場合、相手がデータを送るか close するまでブロックします。
r, w = IO.pipe
Thread.new { sleep 10; w.close }
r.eof? #=> 10秒ブロックしてか......ら true を返す。
r, w = IO.pipe
Thread.new { sleep 10; w.puts "a" }
r.eof? #=> 10秒ブロックしてから false を返す。
r, w = IO.pipe
r.eof? # 永久にブロックします。
eof, eof? は入力バッファにデータを読み込むので、IO#sysread と同時... -
IO
# eof? -> bool (6150.0) -
ストリームがファイルの終端に達した場合、true を返します。そうでない場合、false を返します。
...file")
dummy = f.readlines
f.eof #=> true
自身がパイプやソケットなどのストリームであった場合、相手がデータを送るか close するまでブロックします。
r, w = IO.pipe
Thread.new { sleep 10; w.close }
r.eof? #=> 10秒ブロックしてか......ら true を返す。
r, w = IO.pipe
Thread.new { sleep 10; w.puts "a" }
r.eof? #=> 10秒ブロックしてから false を返す。
r, w = IO.pipe
r.eof? # 永久にブロックします。
eof, eof? は入力バッファにデータを読み込むので、IO#sysread と同時... -
Open3
. # pipeline _ rw(*cmds) -> [IO , IO , [Thread]] (107.0) -
指定したコマンドのリストをパイプで繋いで順番に実行します。最初の コマンドの標準入力に書き込む事も最後のコマンドの標準出力を受けとる事も できます。
...peline_rw("sort", "cat -n") {|stdin, stdout, wait_thrs|
stdin.puts "foo"
stdin.puts "bar"
stdin.puts "baz"
# sortコマンドにEOFを送る。
stdin.close
# stdinに渡した文字列をsortコマンドが並べ替えたものに、catコマンド
# が行番... -
irb (66.0)
-
irb は Interactive Ruby の略です。 irb を使うと、Ruby の式を標準入力から簡単に入力・実行することができます。
..._LIMIT] = 16
IRB.conf[:DEBUG_LEVEL] = 1
IRB.conf[:ECHO] = nil
IRB.conf[:EVAL_HISTORY] = nil
IRB.conf[:HISTORY_FILE] = nil
IRB.conf[:IGNORE_EOF] = true
IRB.conf[:IGNORE_SIGINT] = true
IRB.conf[:INSPECT_MODE] = nil
IRB.conf[:IRB_NAME] = "irb"
IRB.conf[:IRB_RC] = nil
IRB.conf[:MATH_......# サブirbの立ちあげ
irb#1(main):001:0> jobs # サブirbのリスト
#0->irb on main (#<Thread:0x400fb7e4> : stop)
#1->irb#1 on main (#<Thread:0x40125d64> : running)
nil
irb#1(main):002:0> fg 0 # jobのスイッチ
nil
irb(main):002:0>......チ
nil
irb(main):004:0> jobs # jobのリスト
#0->irb on main (#<Thread:0x400fb7e4> : running)
#1->irb#1 on main (#<Thread:0x40125d64> : stop)
#2->irb#2 on Foo (#<Thread:0x4011d54c> : stop)
nil
irb(main):005:0> Foo.instance_methods # Foo#fooがちゃんと......_LIMIT] = 16
IRB.conf[:DEBUG_LEVEL] = 1
IRB.conf[:ECHO] = nil
IRB.conf[:EVAL_HISTORY] = nil
IRB.conf[:HISTORY_FILE] = nil
IRB.conf[:IGNORE_EOF] = true
IRB.conf[:IGNORE_SIGINT] = true
IRB.conf[:INSPECT_MODE] = nil
IRB.conf[:IRB_NAME] = "irb"
IRB.conf[:IRB_RC] = nil
IRB.conf[:PROMP... -
ruby 1
. 8 . 4 feature (54.0) -
ruby 1.8.4 feature ruby 1.8.4 での ruby 1.8.3 からの変更点です。
...feature/Array#fill [bug]>))
* ((<ruby 1.8.4 feature/String#scan [bug]>))
* ((<ruby 1.8.4 feature/File.join [bug]>))
* ((<ruby 1.8.4 feature/Thread#pass [bug]>))
* ((<ruby 1.8.4 feature/Module#const_missing [bug]>))
* ((<ruby 1.8.4 feature/IO [bug]>))
* ((<ruby 1.8.4 feature/添付ライ......05 Guy Decoux <ts@moulon.inra.fr>
#
# * re.c (KR_REHASH): should cast to unsigned for 64bit CPU.
# [ruby-core:06721]
sizeof(long) > sizeof(int) な環境で、ハッシュ関数のオーバー
フローのためにStringをキーとしたHashの検索が失敗していたバ......(<ruby-core:06326>))
: Thread#pass [bug]
#Sun Oct 16 03:38:07 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
#
# * eval.c (load_wait): need not to call rb_thread_schedule()
# explicitly. [ruby-core:04039]
#
# * eval.c (rb_thread_schedule): clear rb_thread_critical.
# [... -
NEWS for Ruby 2
. 3 . 0 (36.0) -
NEWS for Ruby 2.3.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...t show each method (show block lines directly).
TracePoint also ignores these calls.
11569
* Queue (Thread::Queue)
* 終了を通知するために Queue#close(Thread::Queue#close) を追加
10600
* Regexp/String: Unicode のバージョンを 7.0.0 から 8.0.0 に更新......encoding` オプションが追加されました
11785
* Struct
* Struct#dig を追加
11688
* Thread
* スレッド名を扱うために Thread#name, Thread#name= を追加
11251
=== 組み込みクラスの互換性 (機能追加とバグ修正を除く)
* Arra......のIOオブジェクトに IO#close を呼んでも例外が発生しなくなりました。
10718
* IO#each_codepoint は、変換時、EOFの前に不完全な文字があると例外が発生するようになりました。
11444
* Module
* Module#define_method と Object... -
TCPServer (18.0)
-
TCP/IP ストリーム型接続のサーバ側のソケットのクラスです。
...print(s, " is accepted\n")
else
if s.eof?
print(s, " is gone\n")
s.close
socks.delete(s)
else
str = s.gets
s.write(str)
end
end
end
end
Thread を使えばもっと短くなります。
require "so......cket"
gs = TCPServer.open(0)
addr = gs.addr
addr.shift
printf("server is on %s\n", addr.join(":"))
while true
Thread.start(gs.accept) do |s| # save to dynamic variable
print(s, " is accepted\n")
while s.gets
s.write($_)
end
print(s, " is gone... -
Open3
. # pipeline _ rw(*cmds) {|first _ stdin , last _ stdout , wait _ thrs| . . . } -> () (7.0) -
指定したコマンドのリストをパイプで繋いで順番に実行します。最初の コマンドの標準入力に書き込む事も最後のコマンドの標準出力を受けとる事も できます。
...peline_rw("sort", "cat -n") {|stdin, stdout, wait_thrs|
stdin.puts "foo"
stdin.puts "bar"
stdin.puts "baz"
# sortコマンドにEOFを送る。
stdin.close
# stdinに渡した文字列をsortコマンドが並べ替えたものに、catコマンド
# が行番...