Sha256: 0d174c95222b7a88be895602e68cd9ba93c22a57a31d8575465c79205efd713b

Contents?: true

Size: 589 Bytes

Versions: 2

Compression:

Stored size: 589 Bytes

Contents

require 'simplabs/excellent/checks/base'

module Simplabs

  module Excellent

    module Checks

      class MethodNameCheck < NameCheck

        DEFAULT_PATTERN = /^[_a-z<>=\[|+-\/\*\~\%\&`]+[_a-z0-9_<>=~@\[\]]*[=!\?]?$/

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

        def find_name(node)
          node[1]
        end

        protected

          def error_args(node)
            ['Bad method name {{method}}.', { :method => 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/method_name_check.rb
simplabs-excellent-1.0.1 lib/simplabs/excellent/checks/method_name_check.rb