Class: RbSDL2::RWFile
Instance Attribute Summary collapse
-
#path ⇒ Object
(also: #to_path)
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(path, mode = "r") ⇒ RWFile
constructor
A new instance of RWFile.
- #inspect ⇒ Object
Methods inherited from RWOps
#close, #closed?, open, #pos=, #read, #seek, #size, #tell, #to_ptr, #write
Constructor Details
#initialize(path, mode = "r") ⇒ RWFile
Returns a new instance of RWFile.
5 6 7 8 9 10 |
# File 'lib/rb_sdl2/rw_ops/rw_file.rb', line 5 def initialize(path, mode = "r") @path = path ptr = ::SDL.RWFromFile(SDL.str_to_sdl(path), SDL.str_to_sdl(mode)) raise RbSDL2Error if ptr.null? super(RWOpsPointer.new(ptr)) end |
Instance Attribute Details
#path ⇒ Object (readonly) Also known as: to_path
Returns the value of attribute path.
16 17 18 |
# File 'lib/rb_sdl2/rw_ops/rw_file.rb', line 16 def path @path end |
Instance Method Details
#inspect ⇒ Object
12 13 14 |
# File 'lib/rb_sdl2/rw_ops/rw_file.rb', line 12 def inspect "#<#{self.class.name}:#{path}#{closed? ? " (closed)" : nil}>" end |