るりまサーチ

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

別のキーワード

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

クラス

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

StopIteration#result -> object (21127.0)

この例外オブジェクトを発生させる原因となったメソッド等の返り値を返します。

...ect = Object.new
def object.each
yield :yield1
yield :yield2
:each_returned
end

enumerator = object.to_enum

p
enumerator.next #=> :yield1
p
enumerator.next #=> :yield2

begin
enumerator.next
rescue StopIteration => error
p
error.result #=> :each_returned
end...

GC::Profiler.result -> String (21109.0)

GC のプロファイル情報をフォーマットし、文字列として返します。

...生ごとに集計します。
以下は、5 回 GC が発生した場合の実行例です。

$ ruby -e "GC::Profiler.enable; a = Array.new(100000){ 'aa' }; puts GC::Profiler.result"
GC 5 invokes.
Index Invoke Time(sec) Use Size(byte) Total Size(byte) Total Object...
...Time
Ruby が起動してから GC が起動するまでに経過した時間
: Use Size
ヒープ内での使用サイズ
: Total Size
ヒープ全体のサイズ
: Total Object
ヒープ内に存在するオブジェクトの個数
: GC Time
GC の処理時間

@see GC::Profiler.report...

Array#repeated_permutation(n) -> Enumerator (12221.0)

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

...オブジェクトを返します。

@param n 生成する配列のサイズを整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。

@raise TypeError 引数に整数以外の(暗黙...
...a.repeated_permutation(1).to_a #=> [[1], [2]]
a.repeated_permutation(2).to_a #=> [[1,1],[1,2],[2,1],[2,2]]
a.repeated_permutation(3).to_a #=> [[1,1,1],[1,1,2],[1,2,1],[1,2,2],
# [2,1,1],[2,1,2],[2,2,1],[2,2,2]]
a.repeated_permutation(0).to_a #=> [[]] # one perm...
...ロックを実
行して self を返します。

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

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

Array#repeated_permutation(n) { |p| ... } -> self (12221.0)

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

...オブジェクトを返します。

@param n 生成する配列のサイズを整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。

@raise TypeError 引数に整数以外の(暗黙...
...a.repeated_permutation(1).to_a #=> [[1], [2]]
a.repeated_permutation(2).to_a #=> [[1,1],[1,2],[2,1],[2,2]]
a.repeated_permutation(3).to_a #=> [[1,1,1],[1,1,2],[1,2,1],[1,2,2],
# [2,1,1],[2,1,2],[2,2,1],[2,2,2]]
a.repeated_permutation(0).to_a #=> [[]] # one perm...
...ロックを実
行して self を返します。

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

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

Encoding::Converter#primitive_errinfo -> Array (6162.0)

直前の Encoding::Converter#primitive_convert による変換の結果を保持する五要素の配列を返します。

...直前の Encoding::Converter#primitive_convert による変換の結果を保持する五要素の配列を返します。

@return [result, enc1, enc2, error_bytes, readagain_bytes] という五要素の配列

result
は直前の primitive_convert の戻り値です。
それ以外の四要素は...
...:invalid_byte_sequence か :incomplete_input か :undefined_conversion だった場合に意味を持ちます。
enc1 はエラーの発生した原始変換の変換元のエンコーディング、enc2 は変換先のエンコーディングです。
error_bytes はエラーの発生原因とな...
...

p
rimitive_errinfo はもっぱら Encoding::Converter#primitive_convert と組み合わせて使います。Encoding::Converter#convert を用いている場合にも取得することはできますが、有用な使い方は難しいでしょう。

//emlist[][ruby]{
# \xff is invalid as EUC-JP....

絞り込み条件を変える

Object#_dump(limit) -> String (6138.0)

Marshal.#dump において出力するオブジェクトがメソッド _dump を定義している場合には、そのメソッドの結果が書き出されます。

...Marshal.#dump において出力するオブジェクトがメソッド _dump
を定義している場合には、そのメソッドの結果が書き出されます。

バージョン1.8.0以降ではObject#marshal_dump, Object#marshal_loadの使用
が推奨されます。 Marshal.dump するオ...
...mp と marshal_dump の両方の
メソッドを持つ場合は marshal_dump が優先されます。

メソッド _dump は引数として再帰を制限するレベル limit を受
け取り、オブジェクトを文字列化したものを返します。

インスタンスがメソッド _dump...
...あります。

@param limit 再帰の制限レベルを表す整数です。
@return オブジェクトを文字列化したものを返すように定義すべきです。

//emlist[][ruby]{
class Foo
def initialize(arg)
@foo = arg
end
def _dump(limit)
Marshal.dump(@foo, limit)
en...

Object#marshal_dump -> object (6138.0)

Marshal.#dump を制御するメソッドです。

...Marshal.#dump を制御するメソッドです。

Marshal.dump(some) において、出力するオブジェクト some がメソッド marshal_dump
持つ場合には、その返り値がダンプされたものが Marshal.dump(some) の返り値となります。

marshal_dump/marshal_load...
...dump/_load ではなく
marshal_dump/marshal_load を使うべきです。

@return 任意のオブジェクトで marshal_load の引数に利用できます。

//emlist[][ruby]{
class Foo
def initialize(arg)
@foo = arg
end
def marshal_dump
@foo
end
def marshal_load(obj)
p
ob...
...end
foo = Foo.new(['foo', 'bar'])
p
foo #=> #<Foo:0xbaf3b0 @foo=["foo", "bar"]>
dms = Marshal.dump(foo)
p
dms #=> "\004\bU:\bFoo[\a\"\bfoo\"\bbar"
result
= Marshal.load(dms) #=> ["foo", "bar"] # marshal_load の引数
p
result #=> #<Foo:0xb...

IO.popen([env = {}, [cmdname, arg0], *args, execopt={}], mode = "r", opt={}) -> IO (6134.0)

サブプロセスを実行し、そのプロセスの標準入出力 との間にパイプラインを確立します。生成したパイプを IO オブジェクトとして返します。

...イプラインを確立します。生成したパイプを IO オブジェクトとして返します。

p
io = IO.popen("cat", "r+") # => #<IO:fd 4>
io.puts "foo"
io.close_write
p
io.gets # => "foo\n"

サブプロセスを指定する方法は2通りあります。...
...す。ブロックの実行後、生成したパイ
プは自動的にクローズされます。

p
IO.popen("cat", "r+") {|io|
io.puts "foo"
io.close_write
io.gets
}
# => "foo\n"


opt でプロセス起動のためのオプションや、パイプ IO オブジェクトの属性(...
...めのオプションは Kernel.#spawn と、
パイプオブジェクトの属性の指定のオプションは IO.new と共通です。
つまり、 :external_encoding や :unsetenv_others が指定できます。
オプションの詳しい意味は Kernel.#spawn や IO.new を参照してくだ...

IO.popen([env = {}, [cmdname, arg0], *args, execopt={}], mode = "r", opt={}) {|f| ... } -> object (6134.0)

サブプロセスを実行し、そのプロセスの標準入出力 との間にパイプラインを確立します。生成したパイプを IO オブジェクトとして返します。

...イプラインを確立します。生成したパイプを IO オブジェクトとして返します。

p
io = IO.popen("cat", "r+") # => #<IO:fd 4>
io.puts "foo"
io.close_write
p
io.gets # => "foo\n"

サブプロセスを指定する方法は2通りあります。...
...す。ブロックの実行後、生成したパイ
プは自動的にクローズされます。

p
IO.popen("cat", "r+") {|io|
io.puts "foo"
io.close_write
io.gets
}
# => "foo\n"


opt でプロセス起動のためのオプションや、パイプ IO オブジェクトの属性(...
...めのオプションは Kernel.#spawn と、
パイプオブジェクトの属性の指定のオプションは IO.new と共通です。
つまり、 :external_encoding や :unsetenv_others が指定できます。
オプションの詳しい意味は Kernel.#spawn や IO.new を参照してくだ...

IO.popen([env = {}, cmdname, *args, execopt={}], mode = "r", opt={}) -> IO (6134.0)

サブプロセスを実行し、そのプロセスの標準入出力 との間にパイプラインを確立します。生成したパイプを IO オブジェクトとして返します。

...イプラインを確立します。生成したパイプを IO オブジェクトとして返します。

p
io = IO.popen("cat", "r+") # => #<IO:fd 4>
io.puts "foo"
io.close_write
p
io.gets # => "foo\n"

サブプロセスを指定する方法は2通りあります。...
...す。ブロックの実行後、生成したパイ
プは自動的にクローズされます。

p
IO.popen("cat", "r+") {|io|
io.puts "foo"
io.close_write
io.gets
}
# => "foo\n"


opt でプロセス起動のためのオプションや、パイプ IO オブジェクトの属性(...
...めのオプションは Kernel.#spawn と、
パイプオブジェクトの属性の指定のオプションは IO.new と共通です。
つまり、 :external_encoding や :unsetenv_others が指定できます。
オプションの詳しい意味は Kernel.#spawn や IO.new を参照してくだ...

絞り込み条件を変える

<< 1 2 3 ... > >>