Returns the full path to an executable named name
in this gem.
Duplicates array_attributes
from other_spec
so state isn’t shared.
Returns the full path to this spec’s ri directory.
Regenerates plugin wrappers after removal.
Expands code to the next lowest indentation
For example:
1 def dog 2 print "dog" 3 end
If a block starts on line 2 then it has captured all it’s “neighbors” (code at the same indentation or higher). To continue expanding, this block must capture lines one and three which are at a different indentation level.
This method allows fully expanded blocks to decrease their indentation level (so they can expand to capture more code up and down). It does this conservatively as there’s no undo (currently).
Smushes all heredoc lines into one line
source = <<~'EOM' foo = <<~HEREDOC lol hehehe HEREDOC EOM lines = CleanDocument.new(source: source).join_heredoc!.lines expect(lines[0].to_s).to eq(source) expect(lines[1].to_s).to eq("")
Smushes logically “consecutive” lines
source = <<~'EOM' User. where(name: 'schneems'). first EOM lines = CleanDocument.new(source: source).join_consecutive!.lines expect(lines[0].to_s).to eq(source) expect(lines[1].to_s).to eq("")
The one known case this doesn’t handle is:
Ripper.lex <<~EOM a && b || c EOM
For some reason this introduces ‘on_ignore_newline` but with BEG type
Helper method for joining “groups” of lines
Input is expected to be type Array
<Array<CodeLine>>
The outer array holds the various “groups” while the inner array holds code lines.
All code lines are “joined” into the first line in their group.
To preserve document size, empty lines are placed in the place of the lines that were “joined”
Used to hide lines
The search alorithm will group lines into blocks then if those blocks are determined to represent valid code they will be hidden
Returns an array of all the CodeLines that exist after the currently scanned block
Checks the host v
component for RFC2396 compliance and against the URI::Parser
Regexp
for :HOST.
Can not have a registry or opaque component defined, with a host component defined.
Returns a proxy URI
. The proxy URI
is obtained from environment variables such as http_proxy, ftp_proxy, no_proxy, etc. If there is no proper proxy, nil is returned.
If the optional parameter env
is specified, it is used instead of ENV
.
Note that capitalized variables (HTTP_PROXY, FTP_PROXY, NO_PROXY, etc.) are examined, too.
But http_proxy and HTTP_PROXY is treated specially under CGI
environment. It’s because HTTP_PROXY may be set by Proxy: header. So HTTP_PROXY is not used. http_proxy is not used too if the variable is case insensitive. CGI_HTTP_PROXY can be used instead.