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