Sha256: 9008f034470c163ad1b76bc7c209584ebc198102f3c4c1d7f8a6257efa03db29
Contents?: true
Size: 733 Bytes
Versions: 11
Compression:
Stored size: 733 Bytes
Contents
require "rubycritic/analysers/helpers/parser" module Rubycritic class ModulesLocator def initialize(analysed_module) @analysed_module = analysed_module end def first_name names.first end def names return name_from_path if @analysed_module.methods_count == 0 names = node.get_module_names if names.empty? name_from_path else names end end private def node Parser.parse(content) end def content File.read(@analysed_module.path) end def name_from_path [file_name.split("_").map(&:capitalize).join] end def file_name @analysed_module.pathname.basename.sub_ext("").to_s end end end
Version data entries
11 entries across 11 versions & 1 rubygems