Returns Ruby object wrapping OLE variant. The first argument specifies Ruby object to convert OLE variant variable. The second argument specifies VARIANT type. In some situation, you need the WIN32OLE_VARIANT
object to pass OLE method
shell = WIN32OLE.new("Shell.Application") folder = shell.NameSpace("C:\\Windows") item = folder.ParseName("tmp.txt") # You can't use Ruby String object to call FolderItem.InvokeVerb. # Instead, you have to use WIN32OLE_VARIANT object to call the method. shortcut = WIN32OLE_VARIANT.new("Create Shortcut(\&S)") item.invokeVerb(shortcut)
Duplicates self and resets its offset.
d = DateTime.new(2001,2,3,4,5,6,'-02:00') #=> #<DateTime: 2001-02-03T04:05:06-02:00 ...> d.new_offset('+09:00') #=> #<DateTime: 2001-02-03T15:05:06+09:00 ...>
Returns a new binding each time near TOPLEVEL_BINDING for runs that do not specify a binding.
Creates a new ipaddr containing the given network byte ordered string form of an IP address.
Returns an arbitrary seed value. This is used by Random.new
when no seed value is specified as an argument.
Random.new_seed #=> 115032730400174366788466674494640623225
Creates a new MonitorMixin::ConditionVariable
associated with the receiver.
Creates a new Lazy
enumerator. When the enumerator is actually enumerated (e.g. by calling force), obj
will be enumerated and each value passed to the given block. The block can yield values back using yielder
. For example, to create a method filter_map
in both lazy and non-lazy fashions:
module Enumerable def filter_map(&block) map(&block).compact end end class Enumerator::Lazy def filter_map Lazy.new(self) do |yielder, *values| result = yield *values yielder << result if result end end end (1..Float::INFINITY).lazy.filter_map{|i| i*i if i.even?}.first(5) # => [4, 16, 36, 64, 100]
Construct a new Closure
object.
ret
is the C type to be returned
args
is an Array of arguments, passed to the callback function
abi
is the abi of the closure
If there is an error in preparing the ffi_cif or ffi_prep_closure, then a RuntimeError
will be raised.
Constructs a Function
object.
ptr
is a referenced function, of a Fiddle::Handle
args
is an Array of arguments, passed to the ptr
function
ret_type
is the return type of the function
abi
is the ABI of the function
Create a new handler that opens library
with flags
.
If no library
is specified or nil
is given, DEFAULT
is used, which is the equivalent to RTLD_DEFAULT. See man 3 dlopen
for more.
lib = Fiddle::Handle.new
The default is dependent on OS, and provide a handle for all libraries already loaded. For example, in most cases you can use this to access libc
functions, or ruby functions like rb_str_new
.
Create a new handler with the open handlers
Used internally by Fiddle::Importer.dlload
Wraps the C pointer addr
as a C struct with the given types
.
When the instance is garbage collected, the C function func
is called.
See also Fiddle::Pointer.new
Create a new pointer to address
with an optional size
and freefunc
.
freefunc
will be called when the instance is garbage collected.
Construct a new OpenSSL
BIGNUM object.
The string must be a valid cipher name like “AES-128-CBC” or “3DES”.
A list of cipher names is available by calling OpenSSL::Cipher.ciphers
.
Creates an instance of OpenSSL’s configuration class.
This can be used in contexts like OpenSSL::X509::ExtensionFactory.config=
If the optional filename parameter is provided, then it is read in and parsed via parse_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.
Creates a Digest
instance based on string, which is either the ln (long name) or sn (short name) of a supported digest algorithm.
If data (a String) is given, it is used as the initial input to the Digest
instance, i.e.
digest = OpenSSL::Digest.new('sha256', 'digestdata')
is equivalent to
digest = OpenSSL::Digest.new('sha256') digest.update('digestdata')
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' digest = OpenSSL::Digest.new('sha1') instance = OpenSSL::HMAC.new(key, digest) #=> f42bb0eeb018ebbd4597ae7213711ec60760843f instance.class #=> OpenSSL::HMAC
Two instances won’t be equal when they’re compared, even if they have the same value. Use to_s
or hexdigest
to return the authentication code that the instance represents. For example:
other_instance = OpenSSL::HMAC.new('key', OpenSSL::Digest.new('sha1')) #=> f42bb0eeb018ebbd4597ae7213711ec60760843f instance #=> f42bb0eeb018ebbd4597ae7213711ec60760843f instance == other_instance #=> false instance.to_s == other_instance.to_s #=> true
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.