Sanitize a single string.
If the SOURCE_DATE_EPOCH environment variable is set, returns it’s value. Otherwise, returns DEFAULT_SOURCE_DATE_EPOCH
as a string.
NOTE(@duckinator): The implementation is a tad weird because we want to:
1. Make builds reproducible by default, by having this function always return the same result during a given run. 2. Allow changing ENV['SOURCE_DATE_EPOCH'] at runtime, since multiple tests that set this variable will be run in a single process.
If you simplify this function and a lot of tests fail, that is likely due to #2 above.
Details on SOURCE_DATE_EPOCH: reproducible-builds.org/specs/source-date-epoch/
in “” in “foo”
Concatenates each object in objects
into self
; returns self
; performs no encoding validation or conversion:
s = 'foo' s.append_as_bytes(" \xE2\x82") # => "foo \xE2\x82" s.valid_encoding? # => false s.append_as_bytes("\xAC 12") s.valid_encoding? # => true
When a given object is an integer, the value is considered an 8-bit byte; if the integer occupies more than one byte (i.e,. is greater than 255), appends only the low-order byte (similar to String#setbyte
):
s = "" s.append_as_bytes(0, 257) # => "\u0000\u0001" s.bytesize # => 2
Related: see Modifying.
Returns a status string for the response.
Returns the human readable error string corresponding to the error code retrieved by error
.
See also the man page X509_verify_cert_error_string(3).
This method is provided by the Ripper
C extension. It is called when a string needs to be dedented because of a tilde heredoc. It is expected that it will modify the string in place and return the number of bytes that were removed.
Visit an individual part of a string-like node.
“foo” ^^^^^
Apply Ruby
string escaping rules
“foo #{bar}” ^^^^^^^^^^^^
Visit a heredoc node that is representing a string.
IO streams for strings, with access similar to IO
; see IO
.
Examples on this page assume that StringIO has been required:
require 'stringio'
Returns the octet string representation of the elliptic curve point.
conversion_form specifies how the point is converted. Possible values are:
:compressed
:uncompressed
:hybrid
Objects of class Binding
encapsulate the execution context at some particular place in the code and retain this context for future use. The variables, methods, value of self
, and possibly an iterator block that can be accessed in this context are all retained. Binding
objects can be created using Kernel#binding
, and are made available to the callback of Kernel#set_trace_func
and instances of TracePoint
.
These binding objects can be passed as the second argument of the Kernel#eval
method, establishing an environment for the evaluation.
class Demo def initialize(n) @secret = n end def get_binding binding end end k1 = Demo.new(99) b1 = k1.get_binding k2 = Demo.new(-3) b2 = k2.get_binding eval("@secret", b1) #=> 99 eval("@secret", b2) #=> -3 eval("@secret") #=> nil
Binding
objects have no class-specific methods.
foo #{bar}
^^^^^^^^^^^^