Returns the block length of the digest algorithm, i.e. the length in bytes of an individual block. Most modern algorithms partition a message to be digested into a sequence of fix-sized blocks that are processed consecutively.
digest = OpenSSL::Digest.new('SHA1') puts digest.block_length # => 64
Emit a scalar with value
and tag
Emit a sequence with list
and tag
Emit a sequence with map
and tag
Emit an arbitrary object obj
and tag
Called when the document starts with the declared version
, tag_directives
, if the document is implicit
.
version
will be an array of integers indicating the YAML
version being dealt with, tag_directives
is a list of tuples indicating the prefix and suffix of each tag, and implicit
is a boolean indicating whether the document is started implicitly.
Given the following YAML:
%YAML 1.1 %TAG ! tag:tenderlovemaking.com,2009: --- !squee
The parameters for start_document
must be this:
version # => [1, 1] tag_directives # => [["!", "tag:tenderlovemaking.com,2009:"]] implicit # => false
Called with the document ends. implicit
is a boolean value indicating whether or not the document has an implicit ending.
Given the following YAML:
--- hello world
implicit
will be true. Given this YAML:
--- hello world ...
implicit
will be false.
Called before each event with line/column information.
Handles start_document
events with version
, tag_directives
, and implicit
styling.
Handles end_document
events with version
, tag_directives
, and implicit
styling.
Start a document emission with YAML
version
, tags
, and an implicit
start.
End a document emission with an implicit
ending.
Returns the raw error code indicating the cause of the hostname resolution failure.
begin Addrinfo.getaddrinfo("ruby-lang.org", nil) rescue Socket::ResolutionError => e if e.error_code == Socket::EAI_AGAIN puts "Temporary failure in name resolution." end end
Note that error codes depend on the operating system.
Replace %w+% into the environment value of what is contained between the %‘s This method is used for REG_EXPAND_SZ.
For detail, see expandEnvironmentStrings Win32 API.
Takes source
, which can be a string of Ruby code, or an open File
object. that contains Ruby source code. It parses and compiles using prism.
Optionally takes file
, path
, and line
which describe the file path, real path and first line number of the ruby code in source
which are metadata attached to the returned iseq
.
file
is used for ‘__FILE__` and exception backtrace. path
is used for require_relative
base. It is recommended these should be the same full path.
options
, which can be true
, false
or a Hash
, is used to modify the default behavior of the Ruby iseq compiler.
For details regarding valid compile options see ::compile_option=
.
RubyVM::InstructionSequence.compile_prism("a = 1 + 2") #=> <RubyVM::InstructionSequence:<compiled>@<compiled>> path = "test.rb" RubyVM::InstructionSequence.compile_prism(File.read(path), path, File.expand_path(path)) #=> <RubyVM::InstructionSequence:<compiled>@test.rb:1> file = File.open("test.rb") RubyVM::InstructionSequence.compile_prism(file) #=> <RubyVM::InstructionSequence:<compiled>@<compiled>:1> path = File.expand_path("test.rb") RubyVM::InstructionSequence.compile_prism(File.read(path), path, path) #=> <RubyVM::InstructionSequence:<compiled>@/absolute/path/to/test.rb:1>
Like Net::HTTP.get
, but writes the returned body to $stdout; returns nil
.
Like Net::HTTP.get
, but writes the returned body to $stdout; returns nil
.
Represents the location of the variable name.
@@target &&= value ^^^^^^^^