Actions
Bug #15640
closedInconsistent value passed to respond_to_missing?
Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux-gnu]
Description
If the symbol has been defined, then it is passed. Otherwise a string is passed the first time.
class SomeBug
def respond_to_missing?(m, *)
p m
true
end
end
if false then
# uncomment to force to symbol--location doesn't matter, just the literal parse:
# :aa
end
sd = SomeBug.new
# NOTE: single character strings do not show this behavior
sd.method("aa".to_sym) # "aa" unless :aa uncommented above
sd.method("aa".to_sym) # :aa
sd.method("bb".to_sym) # "bb"
sd.method("bb".to_sym) # :bb
Actions
Like0
Like0Like0Like0