Class: Rubycritic::ModulesLocator

Inherits:
Object
  • Object
show all
Defined in:
lib/rubycritic/analysers/helpers/modules_locator.rb

Instance Method Summary collapse

Constructor Details

#initialize(analysed_module) ⇒ ModulesLocator

Returns a new instance of ModulesLocator.



5
6
7
# File 'lib/rubycritic/analysers/helpers/modules_locator.rb', line 5

def initialize(analysed_module)
  @analysed_module = analysed_module
end

Instance Method Details

#first_nameObject



9
10
11
# File 'lib/rubycritic/analysers/helpers/modules_locator.rb', line 9

def first_name
  names.first
end

#namesObject



13
14
15
16
17
18
19
20
# File 'lib/rubycritic/analysers/helpers/modules_locator.rb', line 13

def names
  names = node.get_module_names
  if names.empty?
    name_from_path
  else
    names
  end
end