67件ヒット
[1-67件を表示]
(0.022秒)
別のキーワード
種類
- 特異メソッド (36)
- 文書 (19)
- インスタンスメソッド (12)
キーワード
- Marshal フォーマット (12)
-
NEWS for Ruby 2
. 6 . 0 (7) - read (36)
検索結果
先頭5件
-
Pathname
# binread(*args) -> String | nil (18257.0) -
IO.binread(self.to_s, *args)と同じです。
...IO.binread(self.to_s, *args)と同じです。
//emlist[例][ruby]{
require "pathname"
pathname = Pathname("testfile")
pathname.binread # => "This is line one\nThis is line two\nThis is line three\nAnd so on...\n"
pathname.binread(20) # => "This is line one\nThi"
pathname.binread(2......0, 10) # => "ne one\nThis is line "
//}
@see IO.binread... -
NEWS for Ruby 2
. 6 . 0 (1698.0) -
NEWS for Ruby 2.6.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...言語仕様の変更
* $SAFE はプロセスグローバルで扱われることになると共に、0以外を設定した後に0に戻せるようになりました。 14250
* Refinements がブロック引数にも反映されるようになりました。 14223
* Refinements が Obje......るようになりました。 15326
* Refinements が Object#respond_to? にも反映されるようになりました。 15327
* rescue 節なしの else 節がシンタックスエラーを発生するようになりました。 [実験的] 14606
* 定数名の先頭の文字に ASCII......5
=== 互換性 (機能追加とバグ修正を除く)
* Dir
* Dir.glob に '\0'区切りのパターンリストを渡すのは非推奨になる予定で、
今は警告が出ます。 14643
* File
* File.read, File.binread, File.write, File.binwrite,
File.foreach, File.... -
IO
. read(path , **opt) -> String | nil (106.0) -
path で指定されたファイルを offset 位置から length バイト分読み込んで返します。
...数を配列で指定します。
これらの他、 :external_encoding など
IO.open のオプション引数が指定できます。
@see IO.binread
例:
IO.read(empty_file) #=> ""
IO.read(empty_file, 1) #=> nil
IO.read(one_byte_file, 0, 10) #=> ""
IO.read(one_b... -
IO
. read(path , length = nil , **opt) -> String | nil (106.0) -
path で指定されたファイルを offset 位置から length バイト分読み込んで返します。
...数を配列で指定します。
これらの他、 :external_encoding など
IO.open のオプション引数が指定できます。
@see IO.binread
例:
IO.read(empty_file) #=> ""
IO.read(empty_file, 1) #=> nil
IO.read(one_byte_file, 0, 10) #=> ""
IO.read(one_b... -
IO
. read(path , length = nil , offset = 0 , **opt) -> String | nil (106.0) -
path で指定されたファイルを offset 位置から length バイト分読み込んで返します。
...数を配列で指定します。
これらの他、 :external_encoding など
IO.open のオプション引数が指定できます。
@see IO.binread
例:
IO.read(empty_file) #=> ""
IO.read(empty_file, 1) #=> nil
IO.read(one_byte_file, 0, 10) #=> ""
IO.read(one_b... -
Marshal フォーマット (30.0)
-
Marshal フォーマット フォーマットバージョン 4.8 を元に記述しています。
...それぞれ、'0', 'T', 'F' になります。
//emlist[][ruby]{
p Marshal.dump(nil).unpack1("x2 a*") # => "0"
p Marshal.dump(true).unpack1("x2 a*") # => "T"
p Marshal.dump(false).unpack1("x2 a*") # => "F"
//}
Ruby 2.1 以前では、インスタンス変数を設定しても dump されま......別のためです。
//emlist[例][ruby]{
p Marshal.dump(-1).unpack1("x2 a*") # => "i\xFA"
p Marshal.dump(0).unpack1("x2 a*") # => "i\x00"
p Marshal.dump(1).unpack1("x2 a*") # => "i\x06"
p Marshal.dump(2).unpack1("x2 a*") # => "i\a" ("i\x07")
//}
形式 1 の範囲を超える数値 N に対......ump(Bar, f)
end
# 別プログラム相当にするため remove_const
Object.send :remove_const, :Bar
module Bar
end
p bar = Marshal.load(File.binread('testfile'))
p bar.instance_eval { @bar }
# => nil
//}
//emlist[例 3: クラス変数は dump されない][ruby]{
module Baz
@@baz = 1
def...