るりまサーチ

最速Rubyリファレンスマニュアル検索!
22件ヒット [1-22件を表示] (0.105秒)
トップページ > クエリ:self[x] > クエリ:t[x] > クエリ:binread[x]

別のキーワード

  1. object yield_self
  2. _builtin yield_self
  3. _builtin self
  4. tracepoint self
  5. codeobject document_self

ライブラリ

クラス

検索結果

Pathname#binread(*args) -> String | nil (21257.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 フォーマット (3078.0)

Marshal フォーマット フォーマットバージョン 4.8 を元に記述しています。

...バージョン 4.8 を元に記述しています。

=== nil, true, false

それぞれ、'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....
...で、_dump/_load で対応する必要があります。

//emlist{
| 'u' | クラス名(Symbol)の dump | _dump の結果の長さ(Fixnum形式) | _dump が返す値 |
//}

//emlist[][ruby]{
# coding: ascii-8bit
class Foo
def self._load
end
def _dump(obj)
"hogehoge"
end
end
p Marshal.d...
....instance_eval { @bar } # => 1
File.open('testfile', 'wb') do |f|
Marshal.dump(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[例...