Dump only the raw version string, not the complete object. It’s a string for backwards (RubyGems 1.3.5 and earlier) compatibility.
Load custom marshal format. It’s a string for backwards (RubyGems 1.3.5 and earlier) compatibility.
A recommended version for use with a ~> Requirement.
returns an integer in (-infty, 0] a number closer to 0 means the dependency is less constraining
dependencies w/ 0 or 1 possibilities (ignoring version requirements) are given very negative values, so they always sort first, before dependencies that are unconstrained
Sanitize a single string.
Returns an array with bindir attached to each executable in the executables
list
Returns the full path to installed gem’s bin directory.
NOTE: do not confuse this with bindir
, which is just ‘bin’, not a full path.
Returns the full path to an executable named name
in this gem.
Duplicates Array
and Gem::Requirement
attributes from other_spec
so state isn’t shared.
Issues a warning for each file to be packaged which is world-readable.
Implementation for Specification#validate_permissions
Uninstalls gem spec
Regenerates plugin wrappers after removal.
Display a warning on stderr. Will ask question
if it is not nil.
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”