Load an iseq object from binary format String
object created by RubyVM::InstructionSequence.to_binary
.
This loader does not have a verifier, so that loading broken/modified binary causes critical problem.
You should not load binary data provided by others. You should use binary data translated by yourself.
WARNING This method opens a serious security hole. Never use this method in production code.
Sets the output stream for debugging:
http = Net::HTTP.new(hostname) File.open('t.tmp', 'w') do |file| http.set_debug_output(file) http.start http.get('/nosuch/1') http.finish end puts File.read('t.tmp')
Output:
opening connection to jsonplaceholder.typicode.com:80... opened <- "GET /nosuch/1 HTTP/1.1\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nAccept: */*\r\nUser-Agent: Ruby\r\nHost: jsonplaceholder.typicode.com\r\n\r\n" -> "HTTP/1.1 404 Not Found\r\n" -> "Date: Mon, 12 Dec 2022 21:14:11 GMT\r\n" -> "Content-Type: application/json; charset=utf-8\r\n" -> "Content-Length: 2\r\n" -> "Connection: keep-alive\r\n" -> "X-Powered-By: Express\r\n" -> "X-Ratelimit-Limit: 1000\r\n" -> "X-Ratelimit-Remaining: 999\r\n" -> "X-Ratelimit-Reset: 1670879660\r\n" -> "Vary: Origin, Accept-Encoding\r\n" -> "Access-Control-Allow-Credentials: true\r\n" -> "Cache-Control: max-age=43200\r\n" -> "Pragma: no-cache\r\n" -> "Expires: -1\r\n" -> "X-Content-Type-Options: nosniff\r\n" -> "Etag: W/\"2-vyGp6PvFo4RvsFtPoIWeCReyIC8\"\r\n" -> "Via: 1.1 vegur\r\n" -> "CF-Cache-Status: MISS\r\n" -> "Server-Timing: cf-q-config;dur=1.3000000762986e-05\r\n" -> "Report-To: {\"endpoints\":[{\"url\":\"https:\\/\\/a.nel.cloudflare.com\\/report\\/v3?s=yOr40jo%2BwS1KHzhTlVpl54beJ5Wx2FcG4gGV0XVrh3X9OlR5q4drUn2dkt5DGO4GDcE%2BVXT7CNgJvGs%2BZleIyMu8CLieFiDIvOviOY3EhHg94m0ZNZgrEdpKD0S85S507l1vsEwEHkoTm%2Ff19SiO\"}],\"group\":\"cf-nel\",\"max_age\":604800}\r\n" -> "NEL: {\"success_fraction\":0,\"report_to\":\"cf-nel\",\"max_age\":604800}\r\n" -> "Server: cloudflare\r\n" -> "CF-RAY: 778977dc484ce591-DFW\r\n" -> "alt-svc: h3=\":443\"; ma=86400, h3-29=\":443\"; ma=86400\r\n" -> "\r\n" reading 2 bytes... -> "{}" read 2 bytes Conn keep-alive
WARNING This method opens a serious security hole. Never use this method in production code.
Sets the output stream for debugging:
http = Net::HTTP.new(hostname) File.open('t.tmp', 'w') do |file| http.set_debug_output(file) http.start http.get('/nosuch/1') http.finish end puts File.read('t.tmp')
Output:
opening connection to jsonplaceholder.typicode.com:80... opened <- "GET /nosuch/1 HTTP/1.1\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nAccept: */*\r\nUser-Agent: Ruby\r\nHost: jsonplaceholder.typicode.com\r\n\r\n" -> "HTTP/1.1 404 Not Found\r\n" -> "Date: Mon, 12 Dec 2022 21:14:11 GMT\r\n" -> "Content-Type: application/json; charset=utf-8\r\n" -> "Content-Length: 2\r\n" -> "Connection: keep-alive\r\n" -> "X-Powered-By: Express\r\n" -> "X-Ratelimit-Limit: 1000\r\n" -> "X-Ratelimit-Remaining: 999\r\n" -> "X-Ratelimit-Reset: 1670879660\r\n" -> "Vary: Origin, Accept-Encoding\r\n" -> "Access-Control-Allow-Credentials: true\r\n" -> "Cache-Control: max-age=43200\r\n" -> "Pragma: no-cache\r\n" -> "Expires: -1\r\n" -> "X-Content-Type-Options: nosniff\r\n" -> "Etag: W/\"2-vyGp6PvFo4RvsFtPoIWeCReyIC8\"\r\n" -> "Via: 1.1 vegur\r\n" -> "CF-Cache-Status: MISS\r\n" -> "Server-Timing: cf-q-config;dur=1.3000000762986e-05\r\n" -> "Report-To: {\"endpoints\":[{\"url\":\"https:\\/\\/a.nel.cloudflare.com\\/report\\/v3?s=yOr40jo%2BwS1KHzhTlVpl54beJ5Wx2FcG4gGV0XVrh3X9OlR5q4drUn2dkt5DGO4GDcE%2BVXT7CNgJvGs%2BZleIyMu8CLieFiDIvOviOY3EhHg94m0ZNZgrEdpKD0S85S507l1vsEwEHkoTm%2Ff19SiO\"}],\"group\":\"cf-nel\",\"max_age\":604800}\r\n" -> "NEL: {\"success_fraction\":0,\"report_to\":\"cf-nel\",\"max_age\":604800}\r\n" -> "Server: cloudflare\r\n" -> "CF-RAY: 778977dc484ce591-DFW\r\n" -> "alt-svc: h3=\":443\"; ma=86400, h3-29=\":443\"; ma=86400\r\n" -> "\r\n" reading 2 bytes... -> "{}" read 2 bytes Conn keep-alive
Returns whether the request may have a body:
Net::HTTP::Post.new(uri).request_body_permitted? # => true Net::HTTP::Get.new(uri).request_body_permitted? # => false
Replace the value of start_line
with the given value.
Returns the offset from the start of the file for the given byte offset counting in code units for the given encoding.
This method is tested with UTF-8, UTF-16, and UTF-32. If there is the concept of code units that differs from the number of characters in other encodings, it is not captured here.
We purposefully replace invalid and undefined characters with replacement characters in this conversion. This happens for two reasons. First, it’s possible that the given byte offset will not occur on a character boundary. Second, it’s possible that the source code will contain a character that has no equivalent in the given encoding.
Returns the offset from the start of the file for the given byte offset counting in code units for the given encoding.
This method is tested with UTF-8, UTF-16, and UTF-32. If there is the concept of code units that differs from the number of characters in other encodings, it is not captured here.
The content of the line where this location starts before this location.
Compile a name associated with a constant.
Converts this AvailableSet
into a RequestSet that can be used to install gems.
If development
is :none then no development dependencies are installed. Other options are :shallow for only direct development dependencies of the gems in this set or :all for all development dependencies.
Return true if this spec can require file
.
Regular gems take precedence over default gems
The full path to the gem (install path + full name).
TODO: This is duplicated with gem_dir
. Eventually either of them should be deprecated.
Full paths in the gem to add to $LOAD_PATH
when this gem is activated.
Returns a string usable in Dir.glob
to match all requirable paths for this spec.
Return an array of extra arguments for the command. The extra arguments come from the gem configuration file read at program startup.
Adds extra args from ~/.gemrc
Set
a specific host’s API key to api_key
Remove the +~/.gem/credentials+ file to clear all the current sessions.
The name of the configuration file.
Creates the symlinks to run the applications in the gem. Moves the symlink if the gem being installed has a newer version.