module WinGUI::Util::ScopedStruct

Public Instance Methods

new(*args) { |struct| ... } click to toggle source
Calls superclass method
# File lib/ffi-wingui-core/common.rb, line 43
def new(*args)
        raise ArgumentError, 'Cannot accept both arguments and a block' if
                args.length > 0 && block_given?

        struct = super

        return struct unless block_given?

        begin
                yield struct
        ensure
                struct.pointer.free

                p "Native memory for #{struct} freed" if $DEBUG
        end

        nil
end