Class: RbSDL2::RWObject::SizeCallback

Inherits:
FFI::Function
  • Object
show all
Defined in:
lib/rb_sdl2/rw_ops/rw_object.rb

Instance Method Summary collapse

Constructor Details

#initializeSizeCallback

Returns a new instance of SizeCallback.



56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/rb_sdl2/rw_ops/rw_object.rb', line 56

def initialize
  # Sint64 (* size) (struct RWops * context);
  super(:int64, [:pointer]) do |_context|
    # Ruby ではサイズが不明な IO は size メソッドが無い(NoMethodError)。
    yield
  rescue => e
    raise e if $DEBUG
    Error.last_error_message = e.message
    # 不明な時は -1。
    -1
  end
end