Class: RbSDL2::RWMemory
Instance Method Summary collapse
-
#initialize(obj, readonly: false, size: nil) ⇒ RWMemory
constructor
A new instance of RWMemory.
- #inspect ⇒ Object
Methods inherited from RWOps
#close, #closed?, open, #pos=, #read, #seek, #size, #tell, #to_ptr, #write
Constructor Details
#initialize(obj, readonly: false, size: nil) ⇒ RWMemory
Returns a new instance of RWMemory.
5 6 7 8 9 10 11 12 |
# File 'lib/rb_sdl2/rw_ops/rw_memory.rb', line 5 def initialize(obj, readonly: false, size: nil) raise TypeError, "obj is NULL" if obj.nil? || obj.null? size = size || obj.size ptr = readonly ? ::SDL.RWFromConstMem(obj, size) : ::SDL.RWFromMem(obj, size) raise RbSDL2Error if ptr.null? super(RWOpsPointer.new(ptr)) @obj = obj end |
Instance Method Details
#inspect ⇒ Object
14 15 16 |
# File 'lib/rb_sdl2/rw_ops/rw_memory.rb', line 14 def inspect "#<#{self.class.name}:memory#{closed? ? " (closed)" : nil}>" end |