Ruby: picked up partial name from dynamic method definition
When dynamically defining methods from a string to be eval'd:
M.module_eval <<-RUBY
def _run_#{type}() end
RUBY
a _run_ tag is generated, when it fact nothing should be generated since the string to be eval'd is interpolated at runtime, and as such, it's not safe to try to scan method definitions inside of it.
$ ctags --version
Universal Ctags Development, Copyright (C) 1996-2009 Darren Hiebert
Compiled: Jul 21 2015, 12:41:18
Addresses: <[email protected]>, https://github.com/universal-ctags/ctags
Optional compiled features: +wildcards, +regex, +debug, +option-directory, +coproc
What does `#' mean in ruby?
I found a docment for `#'. http://docs.ruby-lang.org/ja/1.9.3/doc/symref.html#num
I found interesting comment.
https://github.com/universal-ctags/ctags/blob/master/parsers/ruby.c#L269-L287
Yeah, #{} is string interpolation in Ruby. I guess that the parser scans def _run_ and immediately takes it as method definition even if the method’s name isn't yet complete. I think that it should instead ignore the whole definition.