Method: RDoc::Parser::Ruby#parse_method_name

Defined in:
lib/rdoc/parser/ruby.rb

#parse_method_name(container) ⇒ Object

Parses the name of a method in container.

Returns the method name, the container it is in (for def Foo.name) and if it is a singleton or regular method.



1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
# File 'lib/rdoc/parser/ruby.rb', line 1493

def parse_method_name container # :nodoc:
  skip_tkspace
  name_t = get_tk
  back_tk = skip_tkspace_without_nl
  singleton = false

  dot = get_tk
  if dot[:kind] == :on_period || (dot[:kind] == :on_op && dot[:text] == '::') then
    singleton = true

    name, container = parse_method_name_singleton container, name_t
  else
    unget_tk dot
    back_tk.reverse_each do |token|
      unget_tk token
    end

    name = parse_method_name_regular container, name_t
  end

  return name, container, singleton
end