ライブラリ
クラス
-
CSV
:: Table (11) - Shell (12)
- Thread (36)
-
Thread
:: Queue (106) -
Thread
:: SizedQueue (42)
モジュール
- Forwardable (22)
- Kernel (11)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (11) - ConditionVariable (11)
- DelegateClass (11)
- Marshal フォーマット (11)
- Monitor (11)
- MonitorMixin (11)
-
NEWS for Ruby 3
. 0 . 0 (4) - Queue (11)
- SizedQueue (11)
- Stream (11)
- clear (11)
- close (18)
- closed? (9)
-
def
_ delegator (11) -
def
_ instance _ delegator (11) - deq (22)
- empty? (11)
-
ignore
_ deadlock= (3) - irb (11)
- join (22)
- length (11)
-
num
_ waiting (11) - pop (22)
- pushd (6)
- pushdir (6)
-
rb
_ ary _ push (11) -
ruby 1
. 6 feature (11) - shift (22)
- size (11)
- value (11)
検索結果
先頭5件
-
NEWS for Ruby 3
. 0 . 0 (26066.0) -
NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...NEWS for Ruby 3.0.0
このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
それぞれのエントリーは参照情報があるため短いです。
十分な情報と共に書かれた全ての変更のリス......s: Read ENV names and values as UTF-8 encoded Strings 12650
* Encoding
* Added new encoding IBM720. 16233
* Changed default for Encoding.default_external to UTF-8 on Windows 16604
* Fiber
* Fiber.new(blocking: true/false) allows you to create non-blocking execution contexts. 16786......reated from the same block. 14267
* Queue / SizedQueue
* Queue#pop, SizedQueue#push and related methods may now invoke the `block`/`unblock` scheduler hooks in a non-blocking context. 16786
* Ractor
* New class added to enable parallel execution. See rdoc-ref:ractor.md for more details.... -
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (24350.0) -
1.6.8から1.8.0への変更点(まとめ) * ((<1.6.8から1.8.0への変更点(まとめ)/インタプリタの変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたクラス/モジュール>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたメソッド>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加された定数>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張されたクラス/メソッド(互換性のある変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/変更されたクラス/メソッド(互換性のない変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/文法の変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/正規表現>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Marshal>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Windows 対応>)) * ((<1.6.8から1.8.0への変更点(まとめ)/廃止された(される予定の)機能>)) * ((<1.6.8から1.8.0への変更点(まとめ)/ライブラリ>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張ライブラリAPI>)) * ((<1.6.8から1.8.0への変更点(まとめ)/バグ修正>)) * ((<1.6.8から1.8.0への変更点(まとめ)/サポートプラットフォームの追加>))
...スのスーパークラスは同じなのだそうです
((<ruby-bugs-ja:324>))。さあっぱりわかりません(^^;;
class << Object.new
class << self.superclass
p [self.id, self]
end
class << self
p [self.superclass.id, self.supe......けるのに疲れたらしい
^^;;)
: ((<Proc/Proc.new>)) [change]
: ((<組み込み関数/lambda>)) [change]
: ((<組み込み関数/proc>)) [change]
以下のように変更されました。((<ruby-dev:20358>))
* Proc.new およびブロック引数で与えられる Proc は......。
=== Array
: ((<Array#first|Array/first>)) [compat]
: ((<Array#last|Array/last>)) [compat]
省略可能な引数を追加
: ((<Array#push|Array/push>)) [compat]
: ((<Array#unshift|Array/unshift>)) [compat]
: ((<Array#insert|Array/insert>)) [compat]
引数が指定されない場合に、... -
ruby 1
. 6 feature (23294.0) -
ruby 1.6 feature ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン になります。
...00019>))
: 2002-09-11: Queue#((<Queue/pop>))
Queue#pop に競合状態の問題がありました ((<ruby-dev:17223>))
: 2002-09-11: SizedQueue.new
引数に 0 以下を受けつけるバグが修正されました。
: 2002-09-05: ((<リテラル/式展開>))
stable snapshot で、一......nux]
""
=> -:1: parse error
ruby 1.7.3 (2002-10-04) [i586-linux]
: SizedQueue#deq, #shift
: SizedQueue#enq
追加(push, pop の別名)。これらが定義されていなかったため、enq などを
呼び出したときスーパークラス Queue の enq が......フォルト値 (((<Hash/default>))) も == で等しい
ときに等しいとみなされるようになりました。
p Hash.new("foo") == Hash.new("bar")
=> ruby 1.6.7 (2002-03-01) [i586-linux]
true
=> ruby 1.6.7 (2002-08-21) [i586-linux]
false... -
CSV
:: Table # push(*rows) -> self (18119.0) -
複数の行を追加するためのショートカットです。
...タンスか配列を指定します。
//emlist[例][ruby]{
require 'csv'
csv = CSV.new("a,b,c\n1,2,3", headers: true)
table = csv.read
rows = [
CSV::Row.new(table.headers, [4, 5, 6]),
[7, 8, 9]
]
table.push(*rows)
p table[0..2]
# => [#<CSV::Row "a":"1" "b":"2" "c":"3">, #<CSV::Row "a":4 "b":... -
VALUE rb
_ ary _ push(VALUE ary , VALUE item) (6118.0) -
配列 ary の末尾に item を追加します。
...配列 ary の末尾に item を追加します。
対応するRubyコード
ary.push(item) または
ary << item
使用例
VALUE ary = rb_ary_new();
char line[4096];
while ((gets(line)) != NULL){
item = process_apache_log(line);
rb_ary_push(ary, item);
}... -
Shell
# pushd(path = nil , &block) -> object (6106.0) -
カレントディレクトリをディレクトリスタックにつみ, カレントディレク トリをpathにする. pathが省略されたときには, カレントディレクトリと ディレクトリスタックのトップを交換する. イテレータとして呼ばれたと きには, ブロック実行中のみpushdする.
...行中のみpushdする.
@param path カレントディレクトリをpathにする。文字列で指定します。
@param block イテレータとして呼ぶ場合, ブロックを指定します。
動作例
require 'shell'
Shell.verbose = false
sh = Shell.new
sh.pushd("/tmp")
p s......h.cwd #=> "/tmp"
sh.pushd("/usr")
p sh.cwd #=> "/usr"
sh.popd
p sh.cwd #=> "/tmp"
sh.pushd("/usr/local"){
p sh.cwd #=> "/usr/local"
}
p sh.cwd #=> "/tmp"... -
Shell
# pushdir(path = nil , &block) -> object (6106.0) -
カレントディレクトリをディレクトリスタックにつみ, カレントディレク トリをpathにする. pathが省略されたときには, カレントディレクトリと ディレクトリスタックのトップを交換する. イテレータとして呼ばれたと きには, ブロック実行中のみpushdする.
...行中のみpushdする.
@param path カレントディレクトリをpathにする。文字列で指定します。
@param block イテレータとして呼ぶ場合, ブロックを指定します。
動作例
require 'shell'
Shell.verbose = false
sh = Shell.new
sh.pushd("/tmp")
p s......h.cwd #=> "/tmp"
sh.pushd("/usr")
p sh.cwd #=> "/usr"
sh.popd
p sh.cwd #=> "/tmp"
sh.pushd("/usr/local"){
p sh.cwd #=> "/usr/local"
}
p sh.cwd #=> "/tmp"... -
Marshal フォーマット (84.0)
-
Marshal フォーマット フォーマットバージョン 4.8 を元に記述しています。
...dump | 親クラスのインスタンスの dump |
//}
//emlist[例 1][ruby]{
class Foo < Array # (or String, Regexp, Hash)
end
p Marshal.dump(Foo.new([nil])).unpack("x2 a a c a3 aca*")
# => ["C", ":", 8, "Foo", "[", 6, "0"]
# ^^^ (or '"', '/', '{')
//}
==== String, Regexp......数あり][ruby]{
class Foo < Array # (or String, Regexp, Hash)
def initialize(obj)
@foo = false
super(obj)
end
end
p Marshal.dump(Foo.new([true])).unpack("x2 a a a c a3 aca caca4 a")
# => ["I", "C", ":", 8, "Foo", "[", 6, "T", 6, ":", 9, "@foo", "F"]
//}
==== その他
実装上内部......| オブジェクトの実体を指す番号(Fixnum形式) |
//}
//emlist[例][ruby]{
obj = Object.new
p Marshal.dump([obj, obj]).unpack("x2 ac aaca6c aca*")
# => ["[", 7, "o", ":", 11, "Object", 0, "@", 6, ""]
ary = []
ary.push ary
p Marshal.dump(ary).unpack("x2 acac")
# => ["[", 6, "@", 0]
//}... -
Thread
:: ConditionVariable (66.0) -
スレッドの同期機構の一つである状態変数を実現するクラスです。
...レッド a に対して条件が成立したことを通知します。これが典型的な
使用例です。
mutex = Mutex.new
cv = ConditionVariable.new
a = Thread.start {
mutex.synchronize {
...
while (条件が満たされない)
cv.wait(m......max
@full = ConditionVariable.new
@empty = ConditionVariable.new
@mutex = Mutex.new
@q = []
end
def count
@q.size
end
def enq(v)
@mutex.synchronize{
@full.wait(@mutex) if count == @max
@q.push v
@empty.signal if count ==......E__ == $0
q = TinyQueue.new(1)
foods = 'Apple Banana Strawberry Udon Rice Milk'.split
l = []
th = Thread.new {
for obj in foods
q.send(obj)
print "sent ", obj, "\n"
end
q.send nil
}
l.push th
th = Thread.new {
while obj = q.recv... -
Thread
:: SizedQueue # deq(non _ block = false) -> object (40.0) -
キューからひとつ値を取り出します。 キューに push しようと待っているスレッドがあれば、実行を再開させます。
...ます。
キューに push しようと待っているスレッドがあれば、実行を再開させます。
@param non_block true を与えると、キューが空の時に例外 ThreadError が発生します。
//emlist[例][ruby]{
require 'thread'
q = SizedQueue.new(4)
th1 = Thread.start......ch{|r|
q.push(r)
}
th1.join
# => resource1
# resource2
# resource3
//}
//emlist[例: nonblock = true][ruby]{
require 'thread'
q = SizedQueue.new(4)
th1 = Thread.start do
while resource = q.pop
puts resource
end
end
[:resource1, :resource2, :resource3, nil].each{|r|
q.push(r)
}
begi... -
Thread
:: SizedQueue # pop(non _ block = false) -> object (40.0) -
キューからひとつ値を取り出します。 キューに push しようと待っているスレッドがあれば、実行を再開させます。
...ます。
キューに push しようと待っているスレッドがあれば、実行を再開させます。
@param non_block true を与えると、キューが空の時に例外 ThreadError が発生します。
//emlist[例][ruby]{
require 'thread'
q = SizedQueue.new(4)
th1 = Thread.start......ch{|r|
q.push(r)
}
th1.join
# => resource1
# resource2
# resource3
//}
//emlist[例: nonblock = true][ruby]{
require 'thread'
q = SizedQueue.new(4)
th1 = Thread.start do
while resource = q.pop
puts resource
end
end
[:resource1, :resource2, :resource3, nil].each{|r|
q.push(r)
}
begi...