samedi 27 juin 2015

ruby end with a OR operator.

def majority_agreed_commit
  current_commit = log_container.last_commit

  current_term_match_indices = match_indices.values.map do |match_index|
    match_index.downto(current_commit).find do |i|
      log_container.term(i) == current_term
    end || current_commit
  end

I am reading a code piece like this, but I don't understand what's the meaning of this: "end || current_commit" could anybody help me? thanks!

Aucun commentaire:

Enregistrer un commentaire