Sha256: 3682cd1ed2e0bb0cb8f5c74146e87dbc88d18bb276a4971775e78eee1f9b7b0d

Contents?: true

Size: 452 Bytes

Versions: 71

Compression:

Stored size: 452 Bytes

Contents

# frozen_string_literal: true

module Mutant
  module 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

71 entries across 71 versions & 1 rubygems

Version Path
mutant-0.11.13 lib/mutant/ast/node_predicates.rb
mutant-0.11.12 lib/mutant/ast/node_predicates.rb
mutant-0.11.11 lib/mutant/ast/node_predicates.rb
mutant-0.11.10 lib/mutant/ast/node_predicates.rb
mutant-0.11.9 lib/mutant/ast/node_predicates.rb
mutant-0.11.8 lib/mutant/ast/node_predicates.rb
mutant-0.11.7 lib/mutant/ast/node_predicates.rb
mutant-0.11.6 lib/mutant/ast/node_predicates.rb
mutant-0.11.5 lib/mutant/ast/node_predicates.rb
mutant-0.11.4 lib/mutant/ast/node_predicates.rb
mutant-0.11.3 lib/mutant/ast/node_predicates.rb
mutant-0.11.2 lib/mutant/ast/node_predicates.rb
mutant-0.11.1 lib/mutant/ast/node_predicates.rb
mutant-0.11.0 lib/mutant/ast/node_predicates.rb
mutant-0.10.35 lib/mutant/ast/node_predicates.rb
mutant-0.10.34 lib/mutant/ast/node_predicates.rb
mutant-0.10.33 lib/mutant/ast/node_predicates.rb
mutant-0.10.32 lib/mutant/ast/node_predicates.rb
mutant-0.10.31 lib/mutant/ast/node_predicates.rb
mutant-0.10.30 lib/mutant/ast/node_predicates.rb