Method: RDoc::Parser::Ruby#parse_meta_method_name
- Defined in:
- lib/rdoc/parser/ruby.rb
#parse_meta_method_name(comment, tk) ⇒ Object
Parses the name of a metaprogrammed method. comment
is used to determine the name while tk
is used in an error message if the name cannot be determined.
1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 |
# File 'lib/rdoc/parser/ruby.rb', line 1345 def comment, tk # :nodoc: if comment.text.sub!(/^# +:?method: *(\S*).*?\n/i, '') then return $1 unless $1.empty? end name_t = get_tk if :on_symbol == name_t[:kind] then name_t[:text][1..-1] elsif :on_tstring == name_t[:kind] then name_t[:text][1..-2] elsif :on_op == name_t[:kind] && '=' == name_t[:text] then # ignore remove_token_listener self nil else warn "unknown name token #{name_t.inspect} for meta-method '#{tk[:text]}'" 'unknown' end end |