We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1d6ee90 commit 1f0ce6dCopy full SHA for 1f0ce6d
lib/thor/base.rb
@@ -603,13 +603,16 @@ def from_superclass(method, default=nil)
603
else
604
value = superclass.send(method)
605
606
- if value
607
- if value.is_a?(TrueClass) || value.is_a?(Symbol)
608
- value
609
- else
610
- value.dup
611
- end
+ # Ruby implements `dup` on Object, but raises a `TypeError`
+ # if the method is called on immediates. As a result, we
+ # don't have a good way to check whether dup will succeed
+ # without calling it and rescuing the TypeError.
+ begin
+ value.dup
612
+ rescue TypeError
613
+ value
614
end
615
+
616
617
618
0 commit comments