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.


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

def initialize(analysed_module)
  @analysed_module = analysed_module
end

Instance Method Details

#first_nameObject


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

def first_name
  names.first
end

#namesObject


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

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