るりまサーチ

最速Rubyリファレンスマニュアル検索!
977件ヒット [901-977件を表示] (0.094秒)
トップページ > クエリ:p[x] > クエリ:join[x]

別のキーワード

  1. openssl p
  2. openssl p=
  3. fileutils mkdir_p
  4. dsa p
  5. kernel p

ライブラリ

クラス

モジュール

検索結果

<< < ... 8 9 10 >>

Enumerator (12.0)

each 以外のメソッドにも Enumerable の機能を提供するためのラッパークラスです。 また、外部イテレータとしても使えます。

...モジュールは、 Module#include 先のクラスが持つ
each メソッドを元に様々なメソッドを提供します。
例えば Array#map は Array#each の繰り返しを元にして定義されます。
Enumerator を介することにより String#each_byte のような
異なる名...
...ます。
例えば以下のようなスレッドをまたいだ呼び出しはエラーになります。

//emlist[例][ruby]{
a = nil
Thread.new do
a = [1, 2, 3].each
a.next
end.join

p
a.next
#=> t.rb:7:in `next': fiber called across threads (FiberError)
# from t.rb:7:in `<main>'
//}...

Thread#[](name) -> object | nil (12.0)

name に対応したスレッドに固有のデータを取り出します。 name に対応するスレッド固有データがなければ nil を返し ます。

...@param name スレッド固有データのキーを文字列か Symbol で指定します。

//emlist[例][ruby]{
[
Thread.new { Thread.current["name"] = "A" },
Thread.new { Thread.current[:name] = "B" },
Thread.new { Thread.current["name"] = "C" }
].each do |th|
th.join
p
uts "#{th.inspe...
...プとしては
正しく動作しません。

//emlist[][ruby]{
f = Fiber.new {
meth(1) {
Fiber.yield
}
}
meth(2) {
f.resume
}
f.resume
p
Thread.current[:name]
# => nil if fiber-local
# => 2 if thread-local (The value 2 is leaked to outside of meth method.)
//}

Fiber を切り替えて...

ThreadsWait#next_wait(nonblock = nil) -> Thread (12.0)

指定したスレッドのどれかが終了するまで待ちます。

...指定したスレッドのどれかが終了するまで待ちます。

@param nonblock true を与えると、キューが空の時、例外 ThreadsWait::ErrNoFinishedThread が発生します。

@raise ErrNoWaitingThread 終了をまつスレッドが存在しない時、発生します。

@r...
...rue でかつ、キューが空の時、発生します。

#使用例
require 'thwait'

threads = []
2.times {|i|
threads << Thread.new { sleep i }
}

thall = ThreadsWait.new
thall.join_nowait(*threads)
until thall.empty?
th = thall.next_wait
p
th
end

@see Queue#pop...

Zlib::Deflate#set_dictionary(string) -> String (12.0)

圧縮に用いる辞書を指定します。string を返します。 このメソッドは Zlib::Deflate.new, Zlib::ZStream#reset を呼び出した直後にのみ有効です。詳細は zlib.h を参照して下さい。

...@param string 辞書に用いる文字列を指定します。詳しくは zlib.h を参照してください。
@return 辞書に用いる文字列を返します。

require 'zlib'

def case1(str)
dez = Zlib::Deflate.new
comp_str = dez.deflate(str)
comp_str << dez.finish
comp...
..._str.size
end

def case2(str, dict)
dez = Zlib::Deflate.new
p
dez.set_dictionary(dict)
comp_str = dez.deflate(str)
comp_str << dez.finish
comp_str.size
end

i = 10
dict = 'hoge_fuga_ugougo'
sset = [ dict, 'taeagbamike', 'ugotagma', 'fugebogya' ]
g = [ 0, 1, 1, 1, 0,...
...0, 0, 3, 3, 3, 0, 0, 1, 1, 0, 0, 0, 1, 2, 2, 0, 0, 0, 2, 0, 1, 1, 0, 0, 0, 0, 0]
str = (1..i).collect{|m| t = rand(g.size); sset.at(g[t])}.join("")

p
rintf "%d normal:%d, dict:%d\n", i, case1(str), case2(str, dict)...

Zlib::Inflate#set_dictionary(string) -> String (12.0)

展開に用いる辞書を指定します。string を返します。 このメソッドは Zlib::NeedDict 例外が発生した直後のみ 有効です。詳細は zlib.h を参照して下さい。

...h を参照して下さい。

@param string 展開に用いる辞書を文字列で指定します。

require 'zlib'

def case2(str, dict)
dez = Zlib::Deflate.new
dez.set_dictionary(dict)
comp_str = dez.deflate(str)
comp_str << dez.finish
comp_str.size
inz = Zlib::Infla...
...te.new
begin
inz.inflate(comp_str)
rescue Zlib::NeedDict
end
# 展開に用いる辞書が必要です。
inz.set_dictionary(dict)
p
inz.inflate(comp_str)
end
dict = 'hoge_fuga_ugougo'
sset = [ dict, 'taeagbamike', 'ugotagma', 'fugebogya' ]
g = [ 0, 0, 0, 1, 1,...
...1, 0, 0, 0, 3, 3, 3, 0, 0, 1, 1,
0, 0, 0, 1, 2, 2, 0, 0, 0, 2, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0]
str = g.collect{|m| sset.at(m)}.join("")

case2(str, dict)...

絞り込み条件を変える

rinda/rinda (12.0)

Rubyで実装されたタプルスペース(Tuple Space)を扱うためのライブラリです。

...Rubyで実装されたタプルスペース(Tuple Space)を扱うためのライブラリです。

タプルスペースとは並列プログラムにおける一つのパターンです。
並列プログラミングにおいては、ロックのような同期処理が必須ですが、
適切な...
...の実装は rinda/tuplespace でなされています。
このライブラリはタプルスペースへのアクセス機能等を提供します。

=== 参考
* http://www.druby.org/ilikeruby/rinda.html
* http://www2a.biglobe.ne.jp/~seki/ruby/d208.html

===[a:tuplepattern] タプルのパ...
...rinda_ts.rb
require 'drb/drb'
require 'rinda/tuplespace'

uri = ARGV.shift
DRb.start_service(uri, Rinda::TupleSpace.new)
p
uts DRb.uri
DRb.thread.join


# rindas.rb
require 'drb/drb'
require 'rinda/rinda'

def do_it(v)
p
uts "do_it(#{v})"
v + v
end

uri = ARGV.sh...

Array#*(times) -> Array (9.0)

配列の内容を times 回 繰り返した新しい配列を作成して返します。 値はコピーされないことに注意してください。

...とに注意してください。

@param times 繰り返したい回数を整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによ
る暗黙の型変換を試みます。

@raise TypeError 引数に整数以外の(暗...
...黙の型変換が行えない)オブジェクトを
指定した場合に発生します。

@raise ArgumentError 引数に負の数を指定した場合に発生します。

//emlist[例][ruby]{
p
[1, 2, 3] * 3 #=> [1, 2, 3, 1, 2, 3, 1, 2, 3]
//}...
<< < ... 8 9 10 >>