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.



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

def initialize(analysed_module)
  @analysed_module = analysed_module
end

Instance Method Details

#first_nameObject



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

def first_name
  names.first
end

#namesObject



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

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