In Files

Parent

Class Index [+]

Quicksearch

Object

Public Instance Methods

already_mutated?() click to toggle source
     # File lib/heckle.rb, line 571
571:   def already_mutated?
572:     @mutated
573:   end
current_code() click to toggle source
     # File lib/heckle.rb, line 602
602:   def current_code
603:     Ruby2Ruby.translate(klass_name.to_class, method_name)
604:   end
grab_conditional_loop_parts(exp) click to toggle source
     # File lib/heckle.rb, line 564
564:   def grab_conditional_loop_parts(exp)
565:     cond = process(exp.shift)
566:     body = process(exp.shift)
567:     head_controlled = exp.shift
568:     return cond, body, head_controlled
569:   end
mutations_left() click to toggle source
     # File lib/heckle.rb, line 575
575:   def mutations_left
576:     @last_mutations_left ||= 1
577: 
578:     sum = 0
579:     @mutatees.each { |mut| sum += mut.last.size }
580: 
581:     if sum == @last_mutations_left then
582:       puts 'bug!'
583:       puts
584:       require 'pp'
585:       puts 'mutatees:'
586:       pp @mutatees
587:       puts
588:       puts 'original tree:'
589:       pp @original_tree
590:       puts
591:       puts "Infinite loop detected!"
592:       puts "Please save this output to an attachment and submit a ticket here:"
593:       puts "http://rubyforge.org/tracker/?func=add&group_id=1513&atid=5921"
594:       exit 1
595:     else
596:       @last_mutations_left = sum
597:     end
598: 
599:     sum
600:   end
rand_number() click to toggle source

Returns a random Fixnum.

     # File lib/heckle.rb, line 609
609:   def rand_number
610:     (rand(100) + 1)*((1)**rand(2))
611:   end
rand_range() click to toggle source

Returns a random Range

     # File lib/heckle.rb, line 636
636:   def rand_range
637:     min = rand(50)
638:     max = min + rand(50)
639:     min..max
640:   end
rand_string() click to toggle source

Returns a random String

     # File lib/heckle.rb, line 616
616:   def rand_string
617:     size = rand(50)
618:     str = ""
619:     size.times { str << rand(126).chr }
620:     str
621:   end
rand_symbol() click to toggle source

Returns a random Symbol

     # File lib/heckle.rb, line 626
626:   def rand_symbol
627:     letters = ('a'..'z').to_a + ('A'..'Z').to_a
628:     str = ""
629:     (rand(50) + 1).times { str << letters[rand(letters.size)] }
630:     :"#{str}"
631:   end
should_heckle?(exp) click to toggle source
     # File lib/heckle.rb, line 556
556:   def should_heckle?(exp)
557:     return false unless method == method_name
558:     return false if node_count[exp] <= mutation_count[exp]
559:     key = exp.first.to_sym
560: 
561:     mutatees.include?(key) && mutatees[key].include?(exp) && !already_mutated?
562:   end
silence_stream() click to toggle source

Suppresses output on $stdout and $stderr.

     # File lib/heckle.rb, line 645
645:   def silence_stream
646:     return yield if @@debug
647: 
648:     begin
649:       dead = File.open("/dev/null", "w")
650: 
651:       $stdout.flush
652:       $stderr.flush
653: 
654:       oldstdout = $stdout.dup
655:       oldstderr = $stderr.dup
656: 
657:       $stdout.reopen(dead)
658:       $stderr.reopen(dead)
659: 
660:       result = yield
661: 
662:     ensure
663:       $stdout.flush
664:       $stderr.flush
665: 
666:       $stdout.reopen(oldstdout)
667:       $stderr.reopen(oldstderr)
668:       result
669:     end
670:   end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.