Returns an instance of OpenSSL::HMAC
set with the key and digest algorithm to be used. The instance represents the initial state of the message authentication code before any data has been processed. To process data with it, use the instance method update
with your data as an argument.
key = 'key' instance = OpenSSL::HMAC.new(key, 'SHA1') #=> f42bb0eeb018ebbd4597ae7213711ec60760843f instance.class #=> OpenSSL::HMAC
Two instances can be securely compared with ==
in constant time:
other_instance = OpenSSL::HMAC.new('key', 'SHA1') #=> f42bb0eeb018ebbd4597ae7213711ec60760843f instance == other_instance #=> true
Creates an instance of OpenSSL::Config
from the content of the file specified by filename.
This can be used in contexts like OpenSSL::X509::ExtensionFactory.config=
This can raise IO
exceptions based on the access, or availability of the file. A ConfigError
exception may be raised depending on the validity of the data being configured.
Many methods in this class aren’t documented.
Creates a new Psych::Parser
instance with handler
. YAML
events will be called on handler
. See Psych::Parser
for more details.
Create a new scanner
Create a new TreeBuilder
instance
Create a new Psych::Emitter
that writes to io
.
Creates a new Ripper::Filter
instance, passes parameters src
, filename
, and lineno
to Ripper::Lexer.new
The lexer is for internal use only.
family should be an integer, a string or a symbol.
Socket::AF_INET, “AF_INET”, “INET”, :AF_INET, :INET
Socket::AF_UNIX, “AF_UNIX”, “UNIX”, :AF_UNIX, :UNIX
etc.
cmsg_level should be an integer, a string or a symbol.
Socket::SOL_SOCKET, “SOL_SOCKET”, “SOCKET”, :SOL_SOCKET and :SOCKET
Socket::IPPROTO_IP, “IP” and :IP
Socket::IPPROTO_IPV6, “IPV6” and :IPV6
Socket::IPPROTO_TCP, “TCP” and :TCP
etc.
cmsg_type should be an integer, a string or a symbol. If a string/symbol is specified, it is interpreted depend on cmsg_level.
Socket::SCM_RIGHTS, “SCM_RIGHTS”, “RIGHTS”, :SCM_RIGHTS, :RIGHTS for SOL_SOCKET
Socket::IP_RECVTTL, “RECVTTL” and :RECVTTL for IPPROTO_IP
Socket::IPV6_PKTINFO, “PKTINFO” and :PKTINFO for IPPROTO_IPV6
etc.
cmsg_data should be a string.
p Socket::AncillaryData.new(:INET, :TCP, :NODELAY, "") #=> #<Socket::AncillaryData: INET TCP NODELAY ""> p Socket::AncillaryData.new(:INET6, :IPV6, :PKTINFO, "") #=> #<Socket::AncillaryData: INET6 IPV6 PKTINFO "">
remote_address
is an Addrinfo
object.
local_address
is an Addrinfo
object.
reply_proc
is a Proc
used to send reply back to the source.
Returns a new Socket::Option
object.
sockopt = Socket::Option.new(:INET, :SOCKET, :KEEPALIVE, [1].pack("i")) p sockopt #=> #<Socket::Option: INET SOCKET KEEPALIVE 1>
Fills in variables for Logger
compatibility. If this is the first instance of Syslog::Logger
, program_name
may be set to change the logged program name. The facility
may be set to specify the facility level which will be used.
Due to the way syslog works, only one program name may be chosen.
initialize
Returns OLE event object. The first argument specifies WIN32OLE
object. The second argument specifies OLE event name.
ie = WIN32OLE.new('InternetExplorer.Application') ev = WIN32OLE_EVENT.new(ie, 'DWebBrowserEvents')
Returns a new WIN32OLE_METHOD object which represents the information about OLE method. The first argument ole_type specifies WIN32OLE_TYPE object. The second argument method specifies OLE method name defined OLE class which represents WIN32OLE_TYPE object.
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook') method = WIN32OLE_METHOD.new(tobj, 'SaveAs')
Returns WIN32OLE_PARAM object which represents OLE parameter information. 1st argument should be WIN32OLE_METHOD object. 2nd argument ‘n’ is n-th parameter of the method specified by 1st argument.
tobj = WIN32OLE_TYPE.new('Microsoft Scripting Runtime', 'IFileSystem') method = WIN32OLE_METHOD.new(tobj, 'CreateTextFile') param = WIN32OLE_PARAM.new(method, 2) # => #<WIN32OLE_PARAM:Overwrite=true>
Returns WIN32OLE_RECORD object. The first argument is struct name (String
or Symbol
). The second parameter obj should be WIN32OLE
object or WIN32OLE_TYPELIB object. If COM server in VB.NET ComServer project is the following:
Imports System.Runtime.InteropServices Public Class ComClass Public Structure Book <MarshalAs(UnmanagedType.BStr)> _ Public title As String Public cost As Integer End Structure End Class
then, you can create WIN32OLE_RECORD object is as following:
require 'win32ole' obj = WIN32OLE.new('ComServer.ComClass') book1 = WIN32OLE_RECORD.new('Book', obj) # => WIN32OLE_RECORD object tlib = obj.ole_typelib book2 = WIN32OLE_RECORD.new('Book', tlib) # => WIN32OLE_RECORD object
Returns a new WIN32OLE_TYPE object. The first argument typelib specifies OLE type library name. The second argument specifies OLE class name.
WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application') # => WIN32OLE_TYPE object of Application class of Excel.
Returns a new WIN32OLE_TYPELIB object.
The first argument typelib specifies OLE type library name or GUID or OLE library file. The second argument is major version or version of the type library. The third argument is minor version. The second argument and third argument are optional. If the first argument is type library name, then the second and third argument are ignored.
tlib1 = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library') tlib2 = WIN32OLE_TYPELIB.new('{00020813-0000-0000-C000-000000000046}') tlib3 = WIN32OLE_TYPELIB.new('{00020813-0000-0000-C000-000000000046}', 1.3) tlib4 = WIN32OLE_TYPELIB.new('{00020813-0000-0000-C000-000000000046}', 1, 3) tlib5 = WIN32OLE_TYPELIB.new("C:\\WINNT\\SYSTEM32\\SHELL32.DLL") puts tlib1.name # -> 'Microsoft Excel 9.0 Object Library' puts tlib2.name # -> 'Microsoft Excel 9.0 Object Library' puts tlib3.name # -> 'Microsoft Excel 9.0 Object Library' puts tlib4.name # -> 'Microsoft Excel 9.0 Object Library' puts tlib5.name # -> 'Microsoft Shell Controls And Automation'