Welcome to mirror list, hosted at ThFree Co, Russian Federation.

sentence.rb « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 963459e31a33d7be3abd32aad6899af53fabcee2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
# frozen_string_literal: true

module Gitlab
  module Sentence
    extend self
    # Wraps ActiveSupport's Array#to_sentence to convert the given array to a
    # comma-separated sentence joined with localized 'or' Strings instead of 'and'.
    def to_exclusive_sentence(array)
      array.to_sentence(two_words_connector: _(' or '), last_word_connector: _(', or '))
    end
  end
end