module Reek::AST::SexpExtensions::ConstantDefiningNodeBase
Base module for utility methods for nodes that define constants: module definition, class definition and constant assignment.
Public Instance Methods
Source
# File lib/reek/ast/sexp_extensions/module.rb, line 25 def full_name(outer) [outer, name].reject(&:empty?).join('::') end
The full name of the constant, including the name of any module or class it is nested inside of.
For example, given code like this:
module Foo class Bar::Baz end end
The full name for the inner class will be ‘Foo::Bar::Baz’. To return the correct name, the name of the outer context has to be passed into this method.
@param outer [String] full name of the wrapping module or class @return the module’s full name
Source
# File lib/reek/ast/sexp_extensions/module.rb, line 34 def simple_name name.split('::').last end
The final section of the module or class name. For example, for a module with name ‘Foo::Bar’ this will return ‘Bar’; for a module with name ‘Foo’ this will return ‘Foo’.
@return [String] the final section of the name