This represents an error that was encountered during parsing.
Raised when trying to activate a gem, and the gem exists on the system, but not the requested version. Instead of rescuing from this class, make sure to rescue from the superclass Gem::LoadError
to catch all types of load errors.
Raised by Gem::Resolver
when a Gem::Dependency::Conflict reaches the toplevel. Indicates which dependencies were incompatible through conflict
and conflicting_dependencies
Signals that a file permission error is preventing the user from operating on the given directory.
Raised by Gem::Validator
when something is not right in a gem.
Raised by Gem::WebauthnListener when an error occurs during security device verification.
This class is responsible for generating initial code blocks that will then later be expanded.
The biggest concern when guessing code blocks, is accidentally grabbing one that contains only an “end”. In this example:
def dog begonn # misspelled `begin` puts "bark" end end
The following lines would be matched (from bottom to top):
1) end 2) puts "bark" end 3) begonn puts "bark" end
At this point it has no where else to expand, and it will yield this inner code as a block
Not a URI
component.
Raised when a mathematical function is evaluated outside of its domain of definition.
For example, since cos
returns values in the range -1..1, its inverse function acos
is only defined on that interval:
Math.acos(42)
produces:
Math::DomainError: Numerical argument is out of domain - "acos"
Flags for parameter nodes.
Construct a new BlockCaller
object.
ctype
is the C type to be returned
args
are passed the callback
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.
include Fiddle cb = Closure::BlockCaller.new(TYPE_INT, [TYPE_INT]) do |one| one end func = Function.new(cb, [TYPE_INT], TYPE_INT)
Creates a new JSON::Ext::Parser
instance for the string source.
It will be configured by the opts hash. opts can have the following keys:
opts can have the following keys:
max_nesting: The maximum depth of nesting allowed in the parsed data structures. Disable depth checking with :max_nesting => false|nil|0, it defaults to 100.
allow_nan: If set to true, allow NaN, Infinity and -Infinity in defiance of RFC 4627 to be parsed by the Parser
. This option defaults to false.
symbolize_names: If set to true, returns symbols for the names (keys) in a JSON
object. Otherwise strings are returned, which is also the default. It’s not possible to use this option in conjunction with the create_additions option.
create_additions: If set to false, the Parser
doesn’t create additions even if a matching class and create_id was found. This option defaults to false.
object_class: Defaults to Hash
. If another type is provided, it will be used instead of Hash
to represent JSON
objects. The type must respond to new
without arguments, and return an object that respond to []=
.
array_class: Defaults to Array
If another type is provided, it will be used instead of Hash
to represent JSON
arrays. The type must respond to new
without arguments, and return an object that respond to +<<+.
decimal_class: Specifies which class to use instead of the default
(Float) when parsing decimal numbers. This class must accept a single string argument in its constructor.
value: Please have a look at Constructive
and Primitive
to see how Ruby types are mapped to ASN.1 types and vice versa.
tag: An Integer
indicating the tag number.
tag_class: A Symbol
indicating the tag class. Please cf. ASN1
for possible values.
asn1_int = OpenSSL::ASN1Data.new(42, 2, :UNIVERSAL) # => Same as OpenSSL::ASN1::Integer.new(42) tagged_int = OpenSSL::ASN1Data.new(42, 0, :CONTEXT_SPECIFIC) # implicitly 0-tagged INTEGER
Creates a new instance of OpenSSL::PKey::DH
.
If called without arguments, an empty instance without any parameter or key components is created. Use set_pqg
to manually set the parameters afterwards (and optionally set_key
to set private and public key components).
If a String
is given, tries to parse it as a DER- or PEM- encoded parameters. See also OpenSSL::PKey.read
which can parse keys of any kinds.
The DH.new
(size [, generator]) form is an alias of DH.generate
.
string
A String
that contains the DER or PEM encoded key.
size
See DH.generate
.
generator
See DH.generate
.
Examples:
# Creating an instance from scratch # Note that this is deprecated and will not work on OpenSSL 3.0 or later. dh = OpenSSL::PKey::DH.new dh.set_pqg(bn_p, nil, bn_g) # Generating a parameters and a key pair dh = OpenSSL::PKey::DH.new(2048) # An alias of OpenSSL::PKey::DH.generate(2048) # Reading DH parameters dh_params = OpenSSL::PKey::DH.new(File.read('parameters.pem')) # loads parameters only dh = OpenSSL::PKey.generate_key(dh_params) # generates a key pair
Creates a new DSA
instance by reading an existing key from string.
If called without arguments, creates a new instance with no key components set. They can be set individually by set_pqg
and set_key
.
If called with a String
, tries to parse as DER or PEM encoding of a DSA key. See also OpenSSL::PKey.read
which can parse keys of any kinds.
If called with a number, generates random parameters and a key pair. This form works as an alias of DSA.generate
.
string
A String
that contains a DER or PEM encoded key.
pass
A String
that contains an optional password.
size
See DSA.generate
.
Examples:
p OpenSSL::PKey::DSA.new(1024) #=> #<OpenSSL::PKey::DSA:0x000055a8d6025bf0 oid=DSA> p OpenSSL::PKey::DSA.new(File.read('dsa.pem')) #=> #<OpenSSL::PKey::DSA:0x000055555d6b8110 oid=DSA> p OpenSSL::PKey::DSA.new(File.read('dsa.pem'), 'mypassword') #=> #<OpenSSL::PKey::DSA:0x0000556f973c40b8 oid=DSA>
Creates a new EC
object from given arguments.