31件ヒット
[1-31件を表示]
(0.016秒)
別のキーワード
種類
- 文書 (19)
- インスタンスメソッド (12)
ライブラリ
- pathname (12)
クラス
- Pathname (12)
キーワード
- Marshal フォーマット (12)
-
NEWS for Ruby 2
. 6 . 0 (7)
検索結果
-
Pathname
# binread(*args) -> String | nil (18157.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... -
Marshal フォーマット (30.0)
-
Marshal フォーマット フォーマットバージョン 4.8 を元に記述しています。
...ス名(Symbol)の dump | _dump の結果の長さ(Fixnum形式) | _dump が返す値 |
//}
//emlist[][ruby]{
# coding: ascii-8bit
class Foo
def self._load
end
def _dump(obj)
"hogehoge"
end
end
p Marshal.dump(Foo.new).unpack("x2 a aca3 c a*")
# => ["u", ":", 8, "Foo", 13, "hogehoge"]
//}......ct.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 self.baz
@@baz
end
end
p Baz.baz
# => 1
File.open('testfile', 'wb') d......p(Baz, f)
end
# 別プログラム相当にするため remove_const
Object.send :remove_const, :Baz
module Baz
def self.baz
@@baz
end
end
p baz = Marshal.load(File.binread('testfile'))
# => Baz
baz.baz
# => uninitialized class variable @@baz in Baz (NameError)
//}
=== Symbol
':' で始... -
NEWS for Ruby 2
. 6 . 0 (18.0) -
NEWS for Ruby 2.6.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...ァイルオープンを表すモード文字 'x' が追加されました。 11258
* Kernel
* 別名
* Object#then が Object#yield_self の別名として追加されました。 14594
* 新規オプション
* Kernel.#Complex, Kernel.#Float, Kernel.#Integer,
Kernel.......りのパターンリストを渡すのは非推奨になる予定で、
今は警告が出ます。 14643
* File
* File.read, File.binread, File.write, File.binwrite,
File.foreach, File.readlines はパスがパイプ文字 '|' で始まっていても
外部コマンドを......するようになりました。
* BigDecimal.new はバージョン 2.0 で削除予定です。
* Pathname
* Pathname#read, Pathname#binread, Pathname#write,
Pathname#binwrite, Pathname#each_line, Pathname#readlines は
パスがパイプ文字 '|' で始まっていても...