class Crispr::Mutator
Currently, it supports changing ‘true` literals to `false` and vice versa.
Mutator performs simple AST mutations on Ruby source code.
def find_mutations(node)
def find_mutations(node) return [] unless node.is_a?(Parser::AST::Node) local_mutations = Crispr::Mutations::BooleanMutations.mutations_for(node) child_mutations = node.children.flat_map { |child| find_mutations(child) } local_mutations + child_mutations end
def initialize(source_code)
def initialize(source_code) @source_code = source_code end
def mutations
def mutations ast = Parser::CurrentRuby.parse(@source_code) return [] unless ast find_mutations(ast) end