Class: ReservedNames::Win32::Handle

Inherits:
Object
  • Object
show all
Extended by:
Chef::ReservedNames::Win32::API::Process
Defined in:
lib/chef/win32/handle.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(handle) ⇒ Handle

Returns a new instance of Handle.



29
30
31
32
# File 'lib/chef/win32/handle.rb', line 29

def initialize(handle)
  @handle = handle
  ObjectSpace.define_finalizer(self, Handle.close_handle_finalizer(handle))
end

Instance Attribute Details

#handleObject (readonly)

Returns the value of attribute handle.



34
35
36
# File 'lib/chef/win32/handle.rb', line 34

def handle
  @handle
end

Class Method Details

.close_handle(handle) ⇒ Object



40
41
42
43
44
# File 'lib/chef/win32/handle.rb', line 40

def self.close_handle(handle)
  unless CloseHandle(handle)
    Chef::ReservedNames::Win32::Error.raise!
  end
end

.close_handle_finalizer(handle) ⇒ Object



36
37
38
# File 'lib/chef/win32/handle.rb', line 36

def self.close_handle_finalizer(handle)
  proc { close_handle(handle) }
end