Class: Codebreaker::SecretCodeMatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/codebreaker/secret_code_matcher.rb

Constant Summary collapse

EXACT_MATCH_SYMBOL =
'+'.freeze
DIGIT_MATCH_SYMBOL =
'-'.freeze

Instance Method Summary collapse

Constructor Details

#initialize(secret_code, guess_code) ⇒ SecretCodeMatcher

Returns a new instance of SecretCodeMatcher.



6
7
8
9
# File 'lib/codebreaker/secret_code_matcher.rb', line 6

def initialize(secret_code, guess_code)
  @secret_code = secret_code.dup
  @guess_code = guess_code.dup
end

Instance Method Details

#callObject



11
12
13
# File 'lib/codebreaker/secret_code_matcher.rb', line 11

def call
  exact_match + digit_match
end