Sha256: e21b293c5f6a311d581e7822165c43a8503df67e7e0e6a650c96de85b2caa4f3

Contents?: true

Size: 542 Bytes

Versions: 2

Compression:

Stored size: 542 Bytes

Contents

require 'simplabs/excellent/checks/base'

module Simplabs

  module Excellent

    module Checks

      class NameCheck < Base

        def initialize(interesting_nodes, pattern)
          super()
          @interesting_nodes = interesting_nodes
          @pattern           = pattern
        end

        def interesting_nodes
          @interesting_nodes
        end

        def evaluate(node)
          name = find_name(node)
          add_error(*error_args(node)) unless name.to_s =~ @pattern
        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/name_check.rb
simplabs-excellent-1.0.1 lib/simplabs/excellent/checks/name_check.rb