Sha256: ba66bd732cffd885ebe31b01e826807040f586ac3296d881fa9019b069014c98

Contents?: true

Size: 596 Bytes

Versions: 2

Compression:

Stored size: 596 Bytes

Contents

require 'simplabs/excellent/checks/base'

module Simplabs

  module Excellent

    module Checks

      class ModuleNameCheck < NameCheck

        DEFAULT_PATTERN = /^[A-Z][a-zA-Z0-9]*$/

        def initialize(options = {})
          pattern = options['pattern'] || DEFAULT_PATTERN
          super([:module], pattern)
        end

        def find_name(node)
          node[1].class == Symbol ? node[1] : node[1].last
        end

        protected

          def error_args(node)
            ['Bad module name {{module}}.', { :module => node[1] }]
          end

      end

    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
simplabs-excellent-1.0.0 lib/simplabs/excellent/checks/module_name_check.rb
simplabs-excellent-1.0.1 lib/simplabs/excellent/checks/module_name_check.rb