Class: Fzeet::Windows::HANDLE
- Inherits:
-
Object
- Object
- Fzeet::Windows::HANDLE
- Defined in:
- lib/fzeet/windows/core/Common.rb
Constant Summary collapse
- @@instances =
{}
Instance Attribute Summary collapse
-
#handle ⇒ Object
readonly
Returns the value of attribute handle.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#handle ⇒ Object (readonly)
Returns the value of attribute handle.
116 117 118 |
# File 'lib/fzeet/windows/core/Common.rb', line 116 def handle @handle end |
Class Method Details
.instance(handle) ⇒ Object
106 |
# File 'lib/fzeet/windows/core/Common.rb', line 106 def self.instance(handle) raise "#{self}.#{__method__} failed." unless (instance = @@instances[handle.to_i]); instance end |
.instance?(handle) ⇒ Boolean
105 |
# File 'lib/fzeet/windows/core/Common.rb', line 105 def self.instance?(handle) @@instances.include?(handle.to_i) end |
.wrap(handle, *ifaces) ⇒ Object
108 109 110 111 112 113 114 |
# File 'lib/fzeet/windows/core/Common.rb', line 108 def self.wrap(handle, *ifaces) Object.new.tap { |o| o.instance_variable_set(:@handle, handle) o.class.send(:attr_reader, :handle) ifaces.each { |iface| o.class.send(:include, iface) } } end |
Instance Method Details
#attach ⇒ Object
118 |
# File 'lib/fzeet/windows/core/Common.rb', line 118 def attach; @@instances[@handle.to_i] = self end |
#detach ⇒ Object
119 |
# File 'lib/fzeet/windows/core/Common.rb', line 119 def detach; @@instances.delete(@handle.to_i) end |
#dup ⇒ Object
121 |
# File 'lib/fzeet/windows/core/Common.rb', line 121 def dup; raise "#{self}.#{__method__} is not implemented." end |