lib/vigilem/win32_api/rubyized.rb
def _options(opts={})
      opts[:hConsoleInput] ||= get_std_handle()
      
      if opts[:lpBuffer].is_a? Array
        opts[:nLength] = opts[:lpBuffer].size
        opts[:lpBuffer] = Vigilem::Win32API::PINPUT_RECORD.new(opts[:nLength], *opts[:lpBuffer])
      else 
        opts[:nLength] ||= 1
        opts[:lpBuffer] ||= Vigilem::Win32API::PINPUT_RECORD.new(opts[:nLength])
      end
      opts[:lpNumberOfEventsRead] ||= FFI::MemoryPointer.new(:DWORD, 1)
      
      opts
    end
# sets up default options for peek and read based 
# on user input
# @note   default nLength is 1
# @param  [Hash] opts
# @option opts [Integer] :hConsoleInput 
# @option opts [Integer] :nLength 
# @option opts [Win32API::PINPUT_RECORD || Array] :lpBuffer
# @option opts [NilClass || Integer] :lpNumberOfEventsRead
# @option opts [NilClass || TrueClass || FalseClass] :blocking
# @return [Hash]
sets up default options for peek and read based
on user input
sets up default options for peek and read based on user input
def _options(opts={})
      opts[:hConsoleInput] ||= get_std_handle()
      if opts[:lpBuffer].is_a? Array
        opts[:nLength] = opts[:lpBuffer].size
        opts[:lpBuffer] = Vigilem::Win32API::PINPUT_RECORD.new(opts[:nLength], *opts[:lpBuffer])
      else 
        opts[:nLength] ||= 1
        opts[:lpBuffer] ||= Vigilem::Win32API::PINPUT_RECORD.new(opts[:nLength])
      end
      opts[:lpNumberOfEventsRead] ||= FFI::MemoryPointer.new(:DWORD, 1)
      opts
    end
def _options ( opts = { } ) opts [ :hConsoleInput ] ||= get_std_handle ( ) if opts [ :lpBuffer ] . is_a? Array opts [ :nLength ] = opts [ :lpBuffer ] . size opts [ :lpBuffer ] = Vigilem :: Win32API :: PINPUT_RECORD . new ( opts [ :nLength ] , * opts [ :lpBuffer ] ) else opts [ :nLength ] ||= 1 opts [ :lpBuffer ] ||= Vigilem :: Win32API :: PINPUT_RECORD . new ( opts [ :nLength ] ) end opts [ :lpNumberOfEventsRead ] ||= FFI :: MemoryPointer . new ( :DWORD , 1 ) opts end
sets up default options for peek and read based
on user input
sets up default options for peek and read based on user input
None
Hash
opts
None
None
note
default nLength is 1
default nLength is 1