You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As you know, false is the only instance of FalseClass.
If spec is false the RHS will not be evaluated of course and this expression cannot be true usually.
I don't think gemspec files are using classes overriding class method.
Digging
The RHS of this expression seems originally added to catch in Gem::BuildCommand#load_gemspec at 688de7f.
This spec is the result of YAML.load (probably Syck at that time), and it seems to return false when the input contains no entities (an empty input, whitespaces or comment only).
Then 2fbc2b6 added the LHS.
I guess "Raise exception if loaded spec is nil" means the next block, as the expression became never-true at this point.
This may be to support Psych.
Conclusion
I consider this code (and Gem::EndOfYAMLException too?) useless, and can be removed.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
The never-true condition
https://github.com/rubygems/rubygems/blob/83297265aa75b608c75e395b4bb06ffa78a9b52d/lib/rubygems/specification.rb#L1098
As you know,
falseis the only instance ofFalseClass.If
specisfalsethe RHS will not be evaluated of course and this expression cannot be true usually.I don't think gemspec files are using classes overriding
classmethod.Digging
The RHS of this expression seems originally added to catch in Gem::BuildCommand#load_gemspec at 688de7f.
This
specis the result ofYAML.load(probably Syck at that time), and it seems to returnfalsewhen the input contains no entities (an empty input, whitespaces or comment only).Then 2fbc2b6 added the LHS.
I guess "Raise exception if loaded spec is nil" means the next block, as the expression became never-true at this point.
This may be to support Psych.
Conclusion
I consider this code (and
Gem::EndOfYAMLExceptiontoo?) useless, and can be removed.How do you think about it?
All reactions