Sha256: df1871bac00f1aa348c0af0d5967cdae8ed72f22816a8222ddb110182b9d307b

Contents?: true

Size: 421 Bytes

Versions: 36

Compression:

Stored size: 421 Bytes

Contents

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

36 entries across 36 versions & 1 rubygems

Version Path
mutant-0.8.16 lib/mutant/ast/node_predicates.rb
mutant-0.8.15 lib/mutant/ast/node_predicates.rb
mutant-0.8.14 lib/mutant/ast/node_predicates.rb
mutant-0.8.13 lib/mutant/ast/node_predicates.rb
mutant-0.8.12 lib/mutant/ast/node_predicates.rb
mutant-0.8.11 lib/mutant/ast/node_predicates.rb
mutant-0.8.10 lib/mutant/ast/node_predicates.rb
mutant-0.8.9 lib/mutant/ast/node_predicates.rb
mutant-0.8.8 lib/mutant/ast/node_predicates.rb
mutant-0.8.7 lib/mutant/ast/node_predicates.rb
mutant-0.8.6 lib/mutant/ast/node_predicates.rb
mutant-0.8.5 lib/mutant/ast/node_predicates.rb
mutant-0.8.4 lib/mutant/ast/node_predicates.rb
mutant-0.8.3 lib/mutant/ast/node_predicates.rb
mutant-0.8.2 lib/mutant/ast/node_predicates.rb
mutant-0.8.1 lib/mutant/ast/node_predicates.rb
mutant-0.8.0 lib/mutant/ast/node_predicates.rb
mutant-0.7.9 lib/mutant/ast/node_predicates.rb
mutant-0.7.8 lib/mutant/ast/node_predicates.rb
mutant-0.7.7 lib/mutant/ast/node_predicates.rb