Class: Mutants::Detector

Inherits:
Object
  • Object
show all
Defined in:
lib/mutants/detector.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(builder) ⇒ Detector

Returns a new instance of Detector.



7
8
9
# File 'lib/mutants/detector.rb', line 7

def initialize(builder)
  @builder = builder
end

Instance Attribute Details

#builderObject (readonly)

Returns the value of attribute builder.



5
6
7
# File 'lib/mutants/detector.rb', line 5

def builder
  @builder
end

Instance Method Details

#isMutant(sequence) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/mutants/detector.rb', line 11

def isMutant(sequence)
  validate
  return true if dna.horizontal(sequence) ||
                 dna.vertical(sequence) ||
                 dna.bottom_diagonals_from_left_read_without_main_diagonal(sequence) ||
                 dna.bottom_diagonals_from_right_read_without_main_diagonal(sequence) ||
                 dna.top_diagonals_from_left_read_with_main_diagonal(sequence) ||
                 dna.top_diagonals_from_right_read_with_main_diagonal(sequence)
end