るりまサーチ

最速Rubyリファレンスマニュアル検索!
786件ヒット [1-100件を表示] (0.037秒)

別のキーワード

  1. io popen
  2. io pipe
  3. io each
  4. io each_line
  5. io readlines

検索結果

<< 1 2 3 ... > >>

IO#<<(object) -> self (39130.0)

object を出力します。object が文字列でない時にはメソッ ド to_s を用いて文字列に変換します。

...字列でない時にはメソッ
ド to_s を用いて文字列に変換します。

以下のような << の連鎖を使うことができます。

STDOUT << 1 << " is a " << Fixnum << "\n"

@param object 出力したいオブジェクトを与えます。

@raise Errno::EXXX 出力に失敗...
...字列でない時にはメソッ
ド to_s を用いて文字列に変換します。

以下のような << の連鎖を使うことができます。

STDOUT << 1 << " is a " << Integer << "\n"

@param object 出力したいオブジェクトを与えます。

@raise Errno::EXXX 出力に失敗...

StringIO#<<(obj) -> self (21100.0)

obj を pos の位置に書き込みます。 必要なら obj.to_s を呼んで 文字列に変換します。 self を返します。

obj を pos の位置に書き込みます。 必要なら obj.to_s を呼んで
文字列に変換します。 self を返します。

@param obj 自身に書き込みたい、文字列か to_s が定義されたオブジェクトを指定します。

IO#readpartial(maxlen, outbuf = "") -> String (21082.0)

IO から長さ maxlen を上限として読み込み、文字列として返します。 即座に得られるデータが存在しないときにはブロックしてデータの到着を待ちます。 即座に得られるデータが 1byte でも存在すればブロックしません。

...
IO
から長さ maxlen を上限として読み込み、文字列として返します。
即座に得られるデータが存在しないときにはブロックしてデータの到着を待ちます。
即座に得られるデータが 1byte でも存在すればブロックしません。

...
...動作するよう設計されています。
readpartial がブロックするのは次の全ての条件が満たされたときだけです。
* IO オブジェクト内のバッファが空
* ストリームにデータが到着していない
* ストリームが EOF になっていない...
...EOFError を発生させます。

例えば、パイプに対しては次のように動作します。

r, w = IO.pipe # buffer pipe content
w << "abc" # "" "abc".
r.readpartial(4096) #=> "abc" ""...

Zlib::GzipWriter#<<(str) -> self (18118.0)

str を出力します。str が文字列でない場合は to_s を用いて 文字列に変換します。

...ェクトを与えます。

require 'zlib'

filename='hoge1.gz'
fw = File.open(filename, "w")
Zlib::GzipWriter.wrap(fw, Zlib::BEST_COMPRESSION){|gz|
gz << "hoge" << "fuga"
}
fr = File.open(filename)
Zlib::GzipReader.wrap(fr){|gz|
puts gz.read
}
#=> hogefuga

@see IO#<<...

OpenSSL::Buffering#<<(s) -> self (18106.0)

文字列 s を書き込みます。

...文字列 s を書き込みます。

IO
#<< と同様です。

@param s 出力する文字列...

絞り込み条件を変える

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

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

...= 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...

Array#combination(n) -> Enumerator (6106.0)

サイズ n の組み合わせをすべて生成し、それを引数としてブロックを実行します。

...4]
a.combination(1).to_a #=> [[1],[2],[3],[4]]
a.combination(2).to_a #=> [[1,2],[1,3],[1,4],[2,3],[2,4],[3,4]]
a.combination(3).to_a #=> [[1,2,3],[1,2,4],[1,3,4],[2,3,4]]
a.combination(4).to_a #=> [[1,2,3,4]]
a.combination(0).to_a #=> [[]]: one combination of length 0
a.combination(5).to_a #=...
...> [] : no combinations of length 5
//}

ブロックが与えられた場合、作成した配列の各要素を引数としてブロックを実
行して self を返します。

//emlist[例][ruby]{
a = [1, 2, 3, 4]
result = []
a.combination(2) {|e| result << e} # => [1,2,3,4]
result #=> [[1,2],...
...[1,3],[1,4],[2,3],[2,4],[3,4]]
//}

@see Array#permutation, Array#repeated_combination...

Array#combination(n) {|c| block } -> self (6106.0)

サイズ n の組み合わせをすべて生成し、それを引数としてブロックを実行します。

...4]
a.combination(1).to_a #=> [[1],[2],[3],[4]]
a.combination(2).to_a #=> [[1,2],[1,3],[1,4],[2,3],[2,4],[3,4]]
a.combination(3).to_a #=> [[1,2,3],[1,2,4],[1,3,4],[2,3,4]]
a.combination(4).to_a #=> [[1,2,3,4]]
a.combination(0).to_a #=> [[]]: one combination of length 0
a.combination(5).to_a #=...
...> [] : no combinations of length 5
//}

ブロックが与えられた場合、作成した配列の各要素を引数としてブロックを実
行して self を返します。

//emlist[例][ruby]{
a = [1, 2, 3, 4]
result = []
a.combination(2) {|e| result << e} # => [1,2,3,4]
result #=> [[1,2],...
...[1,3],[1,4],[2,3],[2,4],[3,4]]
//}

@see Array#permutation, Array#repeated_combination...

Array#permutation(n = self.length) -> Enumerator (6106.0)

サイズ n の順列をすべて生成し,それを引数としてブロックを実行します。

...ation.to_a #=> [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]
a.permutation(1).to_a #=> [[1],[2],[3]]
a.permutation(2).to_a #=> [[1,2],[1,3],[2,1],[2,3],[3,1],[3,2]]
a.permutation(3).to_a #=> [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]
a.permutation(0).to_a #=> [[]]: one permutation...
...0
a.permutation(4).to_a #=> [] : no permutations of length 4
//}

ブロックが与えられた場合、作成した配列の各要素を引数としてブロックを実
行して self を返します。

//emlist[例][ruby]{
a = [1, 2, 3]
result = []
a.permutation(2) {|e| result << e} # => [1,...
...2,3]
result # => [[1,2],[1,3],[2,1],[2,3],[3,1],[3,2]]
//}

@see Array#combination, Array#repeated_permutation...

Array#permutation(n = self.length) { |p| block } -> self (6106.0)

サイズ n の順列をすべて生成し,それを引数としてブロックを実行します。

...ation.to_a #=> [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]
a.permutation(1).to_a #=> [[1],[2],[3]]
a.permutation(2).to_a #=> [[1,2],[1,3],[2,1],[2,3],[3,1],[3,2]]
a.permutation(3).to_a #=> [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]
a.permutation(0).to_a #=> [[]]: one permutation...
...0
a.permutation(4).to_a #=> [] : no permutations of length 4
//}

ブロックが与えられた場合、作成した配列の各要素を引数としてブロックを実
行して self を返します。

//emlist[例][ruby]{
a = [1, 2, 3]
result = []
a.permutation(2) {|e| result << e} # => [1,...
...2,3]
result # => [[1,2],[1,3],[2,1],[2,3],[3,1],[3,2]]
//}

@see Array#combination, Array#repeated_permutation...

絞り込み条件を変える

<< 1 2 3 ... > >>