Sha256: 5d1eac63ddff0a5fff0dd3f3ad206a2a6652839cbe0faa96422322c5dd697b2a

Contents?: true

Size: 451 Bytes

Versions: 25

Compression:

Stored size: 451 Bytes

Contents

# frozen_string_literal: true

module Mutant
  class AST
    # Module for node predicates
    module NodePredicates

      Types::ALL.each do |type|
        fail "method: #{type} is already defined" if instance_methods(true).include?(type)

        name = "n_#{type.to_s.chomp('?')}?"

        define_method(name) do |node|
          node.type.equal?(type)
        end
        private name
      end

    end # NodePredicates
  end # AST
end # Mutant

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
mutant-0.12.4 lib/mutant/ast/node_predicates.rb
mutant-0.12.3 lib/mutant/ast/node_predicates.rb
mutant-0.12.2 lib/mutant/ast/node_predicates.rb
mutant-0.12.0 lib/mutant/ast/node_predicates.rb
mutant-0.11.34 lib/mutant/ast/node_predicates.rb
mutant-0.11.33 lib/mutant/ast/node_predicates.rb
mutant-0.11.32 lib/mutant/ast/node_predicates.rb
mutant-0.11.31 lib/mutant/ast/node_predicates.rb
mutant-0.11.30 lib/mutant/ast/node_predicates.rb
mutant-0.11.29 lib/mutant/ast/node_predicates.rb
mutant-0.11.28 lib/mutant/ast/node_predicates.rb
mutant-0.11.27 lib/mutant/ast/node_predicates.rb
mutant-0.11.26 lib/mutant/ast/node_predicates.rb
mutant-0.11.25 lib/mutant/ast/node_predicates.rb
mutant-0.11.24 lib/mutant/ast/node_predicates.rb
mutant-0.11.23 lib/mutant/ast/node_predicates.rb
mutant-0.11.22 lib/mutant/ast/node_predicates.rb
mutant-0.11.21 lib/mutant/ast/node_predicates.rb
mutant-0.11.20 lib/mutant/ast/node_predicates.rb
mutant-0.11.19 lib/mutant/ast/node_predicates.rb