Class: Exerb::Win32::Struct::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/exerb/win32/struct/base.rb

Overview

#

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBase

Returns a new instance of Base.



17
18
19
# File 'lib/exerb/win32/struct/base.rb', line 17

def initialize
  @position = nil
end

Instance Attribute Details

#positionObject (readonly)

Returns the value of attribute position.



21
22
23
# File 'lib/exerb/win32/struct/base.rb', line 21

def position
  @position
end

Class Method Details

.read(io) ⇒ Object



23
24
25
# File 'lib/exerb/win32/struct/base.rb', line 23

def self.read(io)
  return self.new.read(io)
end

Instance Method Details

#read(io) ⇒ Object



31
32
33
34
# File 'lib/exerb/win32/struct/base.rb', line 31

def read(io)
  @position = io.pos
  return self.unpack(io.read(self.size))
end

#sizeObject



27
28
29
# File 'lib/exerb/win32/struct/base.rb', line 27

def size
  return self.pack.size
end

#update(str) ⇒ Object



36
37
38
# File 'lib/exerb/win32/struct/base.rb', line 36

def update(str)
  str[@position, self.size] = self.pack
end