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
-
The never-true condition
rubygems/lib/rubygems/specification.rb
Line 1098 in 8329726
As you know,
false
is the only instance ofFalseClass
.If
spec
isfalse
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 ofYAML.load
(probably Syck at that time), and it seems to returnfalse
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.How do you think about it?
Beta Was this translation helpful? Give feedback.
All reactions