Sha256: 908ea1b994fee3dd4ef7dad19c2cc593c550eb9d8ef3386bf2f6c3a496a8fb62

Contents?: true

Size: 580 Bytes

Versions: 13

Compression:

Stored size: 580 Bytes

Contents

require 'roodi/checks/name_check'

module Roodi
  module Checks
    # Checks a module name to make sure it matches the specified pattern.
    # 
    # Keeping to a consistent nameing convention makes your code easier to read.
    class ModuleNameCheck < NameCheck
      DEFAULT_PATTERN = /^[A-Z][a-zA-Z0-9]*$/
      
      def initialize(options = {})
        pattern = options['pattern'] || DEFAULT_PATTERN
        super([:module], pattern, 'Module')
      end
      
      def find_name(node)
        node[1].class == Symbol ? node[1] : node[1].last
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 3 rubygems

Version Path
threedaymonk-roodi-1.3.8 lib/roodi/checks/module_name_check.rb
roodi1.9-2.0.1 lib/roodi/checks/module_name_check.rb
roodi-2.1.0 lib/roodi/checks/module_name_check.rb
roodi-2.0.1 lib/roodi/checks/module_name_check.rb
roodi-2.0.0 lib/roodi/checks/module_name_check.rb
roodi-1.3.5 lib/roodi/checks/module_name_check.rb
roodi-1.3.7 lib/roodi/checks/module_name_check.rb
roodi-1.3.6 lib/roodi/checks/module_name_check.rb
roodi-1.3.4 lib/roodi/checks/module_name_check.rb
roodi-1.3.3 lib/roodi/checks/module_name_check.rb
roodi-1.3.0 lib/roodi/checks/module_name_check.rb
roodi-1.4.0 lib/roodi/checks/module_name_check.rb
roodi-1.3.2 lib/roodi/checks/module_name_check.rb