Sha256: 955ccb9b055ce3d20edfcca9da342a16cc379f9953699b2590d5a896cbad411d

Contents?: true

Size: 889 Bytes

Versions: 2

Compression:

Stored size: 889 Bytes

Contents

module Kolekti
  module Metricfu
    module Parsers
      class Base < Kolekti::Parser
        def self.module_name_suffix(module_name)
          return '' if module_name.to_s.end_with?('#none')

          # Replace Saikuro's representation of a class method (#self.method) with Flog's
          # (::method) so we can treat both the same later.
          module_name = module_name.gsub('#self.', '::')
          # Now split up the last component of the module name so it doesn't get it's
          # prefixes (# or ::) replaced with . (our own separator).
          module_path, prefix, module_name = module_name.rpartition(/#|::/)
          # Replace the separators in the path (and only the path) with dots
          module_path.gsub!(/#|::/, '.')
          # Put everything back together
          '.' + module_path + '.' + prefix + module_name
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
kolekti_metricfu-5.0.0 lib/kolekti/metricfu/parsers/base.rb
kolekti_metricfu-0.0.4 lib/kolekti/metricfu/parsers/base.rb