Sha256: b31b0f138d687195a5361f1b136b1c868461c71fde5cf3522099612d8a8f08fb

Contents?: true

Size: 582 Bytes

Versions: 4

Compression:

Stored size: 582 Bytes

Contents

module RuboCop
  module Cop
    module DarkFinger
      class ModuleAncestorChainExtractor
        attr_reader :node

        def initialize(node)
          @node = node
        end

        def perform
          module_chain = [node.children.first.const_name]

          current_node = node
          while current_node.parent && current_node.parent.module_type?
            module_chain << current_node.parent.children.first.const_name
            current_node = current_node.parent
          end

          module_chain.reverse.join("::")
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
dark_finger-0.6.1 lib/rubocop/cop/dark_finger/module_ancestor_chain_extractor.rb
dark_finger-0.6.0 lib/rubocop/cop/dark_finger/module_ancestor_chain_extractor.rb
dark_finger-0.5.1 lib/rubocop/cop/dark_finger/module_ancestor_chain_extractor.rb
dark_finger-0.5.0 lib/rubocop/cop/dark_finger/module_ancestor_chain_extractor.rb