I have code like the following (truncated/paraphrased for readability)
def board_check?
@board.each {|row| check_row_for_truth_conditions(row)}
end
def check_row_for_truth_conditions(row)
return true if row.include("foo")
false
end
Right now the implicit return of that each iterator is always the collection it is iterating over. ie; I get the array back, not true or false. If I don't refactor and do something like the following, it works as expected. However I use the check_row_for_truth_conditions in many places (and it is much longer), so would like to refactor it out
def board_check?
@board.each do |row|
return true if row.include("foo")
false
end
end