lib/win/library.rb in win-0.3.1 vs lib/win/library.rb in win-0.3.3

- old
+ new

@@ -305,15 +305,15 @@ # If you do so, snake_case method is defined based on your *def_block*. It receives callable API # object for function being defined, arguments and (optional) runtime block with which the method # will be called. Results coming from &def_block are then transformed and returned. # So, your *def_block* should specify all the behavior of the method being defined. You can use *def_block* to: # - Change original signature of API function, provide argument defaults, check argument types - # - Pack arguments into strings/structs for [in] or [in/out] parameters that expect a pointer - # - Allocate buffers/structs for pointers required by API functions [out] parameters - # - Unpack [out] and [in/out] parameters returned as pointers - # - Explicitly return results of API call that are returned in [out] and [in/out] parameters - # - Convert attached runtime blocks into callback functions and stuff them into [in] callback parameters + # - Pack arguments into strings/structs for <in> or <in/out> parameters that expect a pointer + # - Allocate buffers/structs for pointers required by API functions <out> parameters + # - Unpack <out> and <in/out> parameters returned as pointers + # - Explicitly return results of API call that are returned in <out> and <in/out> parameters + # - Convert attached runtime blocks into callback functions and stuff them into <in> callback parameters # - do other stuff that you think is appropriate to make Windows API function behavior more Ruby-like... # --- # Accepts following options: # :dll:: Use this dll instead of default 'user32' # :rename:: Use this name instead of standard (conventional) function name @@ -447,16 +447,20 @@ # with both FFI::Library methods and Win::Library macro methods like 'function'. # def self.included(klass) klass.extend FFI::Library - eigenklass = class << klass; self; end # Extracting host class's eigenclass + # Extracting host class's eigenclass + # :stopdoc: + eigenklass = class << klass; self; end # :nodoc: + eigenklass.class_eval do define_method(:namespace) {klass} # Defining new class method for host pointing to itself alias_method :attach_callback, :callback include ClassMethods end + # :startdoc: klass.ffi_lib 'user32', 'kernel32' # Default libraries klass.ffi_convention :stdcall end end \ No newline at end of file