Replies: 2 comments
-
|
Makes sense @nobu, thanks for digging and PR appreciated! |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
@nobu Are you still interested in simplifying this code? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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?
Beta Was this translation helpful? Give feedback.
All reactions