Sha256: bc5935a2e2b77bb7f52698d03a009c694ee155f36c18ba630d1089d398677881

Contents?: true

Size: 567 Bytes

Versions: 12

Compression:

Stored size: 567 Bytes

Contents

require 'roodi/checks/name_check'

module Roodi
  module Checks
    # Checks a method name to make sure it matches the specified pattern.
    # 
    # Keeping to a consistent nameing convention makes your code easier to read.
    class MethodNameCheck < NameCheck
      DEFAULT_PATTERN = /^[_a-z<>=\[|+-\/\*`]+[_a-z0-9_<>=~@\[\]]*[=!\?]?$/
      
      def initialize(options = {})
        pattern = options['pattern'] || DEFAULT_PATTERN
        super([:defn], pattern, 'Method')
      end
      
      def find_name(node)
        node[1]
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 3 rubygems

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