Method: RDoc::Parser::PrismRuby#add_constant
- Defined in:
- lib/rdoc/parser/prism_ruby.rb
#add_constant(constant_name, rhs_name, start_line, end_line) ⇒ Object
Adds a constant
611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 |
# File 'lib/rdoc/parser/prism_ruby.rb', line 611 def add_constant(constant_name, rhs_name, start_line, end_line) comment = consecutive_comment(start_line) handle_consecutive_comment_directive(@container, comment) owner, name = find_or_create_constant_owner_name(constant_name) constant = RDoc::Constant.new(name, rhs_name, comment) constant.store = @store constant.line = start_line record_location(constant) handle_modifier_directive(constant, start_line) handle_modifier_directive(constant, end_line) owner.add_constant(constant) mod = if rhs_name =~ /^::/ @store.find_class_or_module(rhs_name) else @container.find_module_named(rhs_name) end if mod && constant.document_self a = @container.add_module_alias(mod, rhs_name, constant, @top_level) a.store = @store a.line = start_line record_location(a) end end |