class RubyCritic::ModulesLocator
Public Class Methods
new(analysed_module)
click to toggle source
# File lib/rubycritic/analysers/helpers/modules_locator.rb, line 7 def initialize(analysed_module) @analysed_module = analysed_module end
Public Instance Methods
first_name()
click to toggle source
# File lib/rubycritic/analysers/helpers/modules_locator.rb, line 11 def first_name name_from_path.first end
names()
click to toggle source
# 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
Private Instance Methods
content()
click to toggle source
# File lib/rubycritic/analysers/helpers/modules_locator.rb, line 30 def content File.read(@analysed_module.path) end
file_name()
click to toggle source
# File lib/rubycritic/analysers/helpers/modules_locator.rb, line 38 def file_name @analysed_module.pathname.basename.sub_ext('').to_s end
name_from_path()
click to toggle source
# File lib/rubycritic/analysers/helpers/modules_locator.rb, line 34 def name_from_path [file_name.split('_').map(&:capitalize).join] end
node()
click to toggle source
# File lib/rubycritic/analysers/helpers/modules_locator.rb, line 26 def node Parser.parse(content) end