るりまサーチ

最速Rubyリファレンスマニュアル検索!
356件ヒット [201-300件を表示] (0.091秒)

別のキーワード

  1. _builtin -
  2. open-uri open
  3. irb/input-method new
  4. irb/input-method gets
  5. matrix -

検索結果

<< < 1 2 3 4 > >>

Random#marshal_load(array) -> Random (135.0)

Random#marshal_dump で得られた配列を基に、Randomオブジェクトを復元します。

...Random#marshal_dump で得られた配列を基に、Randomオブジェクトを復元します。

@param array 三要素以下からなる配列を指定します。
何を指定するかはRandom#marshal_dumpを参考にしてください。

@raise ArgumentError array が3より大...
...きい場合に発生します。

//emlist[例][ruby]{
r1 = Random.new(1)
a1 = r1.marshal_dump
r2 = Random.new(3)
r3 = r2.marshal_load(a1)

p r1 == r2 # => true
p r1 == r3 # => true
//}

@see Random#marshal_dump...

Encoding::Converter#primitive_convert(source_buffer, destination_buffer) -> Symbol (125.0)

エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。

...Encoding::Converter.new("UTF-8", "EUC-JP")
src = "abc\x81あいう\u{20bb7}\xe3"
dst = ''

begin
ret = ec.primitive_convert(src, dst)
p [ret, src, dst, ec.primitive_errinfo]
case ret
when :invalid_byte_sequence
ec.insert_output(ec.primitive_errinfo[3].dump[1..-2])
redo
when :undefi...
...rrinfo[1])
ec.insert_output('\x{%X:%s}' % [c.ord, c.encoding])
redo
when :incomplete_input
ec.insert_output(ec.primitive_errinfo[3].dump[1..-2])
when :finished
end
break
end while nil
//}

不正なバイトや変換先で未定義なバイトをエスケープしつつ変換す...

Encoding::Converter#primitive_convert(source_buffer, destination_buffer, destination_byteoffset) -> Symbol (125.0)

エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。

...Encoding::Converter.new("UTF-8", "EUC-JP")
src = "abc\x81あいう\u{20bb7}\xe3"
dst = ''

begin
ret = ec.primitive_convert(src, dst)
p [ret, src, dst, ec.primitive_errinfo]
case ret
when :invalid_byte_sequence
ec.insert_output(ec.primitive_errinfo[3].dump[1..-2])
redo
when :undefi...
...rrinfo[1])
ec.insert_output('\x{%X:%s}' % [c.ord, c.encoding])
redo
when :incomplete_input
ec.insert_output(ec.primitive_errinfo[3].dump[1..-2])
when :finished
end
break
end while nil
//}

不正なバイトや変換先で未定義なバイトをエスケープしつつ変換す...

Encoding::Converter#primitive_convert(source_buffer, destination_buffer, destination_byteoffset, destination_bytesize) -> Symbol (125.0)

エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。

...Encoding::Converter.new("UTF-8", "EUC-JP")
src = "abc\x81あいう\u{20bb7}\xe3"
dst = ''

begin
ret = ec.primitive_convert(src, dst)
p [ret, src, dst, ec.primitive_errinfo]
case ret
when :invalid_byte_sequence
ec.insert_output(ec.primitive_errinfo[3].dump[1..-2])
redo
when :undefi...
...rrinfo[1])
ec.insert_output('\x{%X:%s}' % [c.ord, c.encoding])
redo
when :incomplete_input
ec.insert_output(ec.primitive_errinfo[3].dump[1..-2])
when :finished
end
break
end while nil
//}

不正なバイトや変換先で未定義なバイトをエスケープしつつ変換す...

Encoding::Converter#primitive_convert(source_buffer, destination_buffer, destination_byteoffset, destination_bytesize, options) -> Symbol (125.0)

エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。

...Encoding::Converter.new("UTF-8", "EUC-JP")
src = "abc\x81あいう\u{20bb7}\xe3"
dst = ''

begin
ret = ec.primitive_convert(src, dst)
p [ret, src, dst, ec.primitive_errinfo]
case ret
when :invalid_byte_sequence
ec.insert_output(ec.primitive_errinfo[3].dump[1..-2])
redo
when :undefi...
...rrinfo[1])
ec.insert_output('\x{%X:%s}' % [c.ord, c.encoding])
redo
when :incomplete_input
ec.insert_output(ec.primitive_errinfo[3].dump[1..-2])
when :finished
end
break
end while nil
//}

不正なバイトや変換先で未定義なバイトをエスケープしつつ変換す...

絞り込み条件を変える

Encoding::UndefinedConversionError#error_char -> String (119.0)

エラーを発生させた1文字を文字列で返します。

...エラーを発生させた1文字を文字列で返します。

//emlist[例][ruby]{
ec = Encoding::Converter.new("UTF-8", "EUC-JP")
begin
ec.convert("\u{a0}")
rescue Encoding::UndefinedConversionError
puts $!.error_char.dump #=> "\u{a0}"
end
//}...

Class#_load(str) -> Class (117.0)

Object#_dump を参照して下さい。

...Object#_dump を参照して下さい。

@param str Ruby のオブジェクトがダンプされた文字列を指定します。...

Object#clone(freeze: nil) -> object (113.0)

オブジェクトの複製を作成して返します。

...y)といいます。

深い(deep)コピーが必要な場合には、
Marshalモジュールを利用して
//emlist[][ruby]{
Marshal.load(Marshal.dump(obj))
//}
このように複製を作成する方法があります。ただしMarshal出来ないオブジェクトが
含まれている場合に...
...は使えません。

//emlist[][ruby]{
obj = ["a","b","c"]

obj_d = obj.dup
obj_d[0] << "PLUS"

p obj #=> ["aPLUS", "b", "c"]
p obj_d #=> ["aPLUS", "b", "c"]

obj_m = Marshal.load(Marshal.dump(obj))
obj_m[1] << "PLUS"

p obj #=> ["aPLUS", "b", "c"]
p obj_m #=> ["aPLUS", "bPLUS", "c"]
//}...

Object#dup -> object (113.0)

オブジェクトの複製を作成して返します。

...y)といいます。

深い(deep)コピーが必要な場合には、
Marshalモジュールを利用して
//emlist[][ruby]{
Marshal.load(Marshal.dump(obj))
//}
このように複製を作成する方法があります。ただしMarshal出来ないオブジェクトが
含まれている場合に...
...は使えません。

//emlist[][ruby]{
obj = ["a","b","c"]

obj_d = obj.dup
obj_d[0] << "PLUS"

p obj #=> ["aPLUS", "b", "c"]
p obj_d #=> ["aPLUS", "b", "c"]

obj_m = Marshal.load(Marshal.dump(obj))
obj_m[1] << "PLUS"

p obj #=> ["aPLUS", "b", "c"]
p obj_m #=> ["aPLUS", "bPLUS", "c"]
//}...
<< < 1 2 3 4 > >>