Sha256: 728333e7d6f70390491ecf426159cd020f890955137657e36da450005bc31634

Contents?: true

Size: 236 Bytes

Versions: 5

Compression:

Stored size: 236 Bytes

Contents

# frozen_string_literal: true

module Openapi3Parser
  module ArraySentence
    refine ::Array do
      def sentence_join
        return join if count < 2

        "#{self[0..-2].join(', ')} and #{self[-1]}"
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
openapi3_parser-0.10.1 lib/openapi3_parser/array_sentence.rb
openapi3_parser-0.9.2 lib/openapi3_parser/array_sentence.rb
mountapi-0.11.1 vendor/bundle/ruby/2.7.0/gems/openapi3_parser-0.9.1/lib/openapi3_parser/array_sentence.rb
openapi3_parser-0.9.1 lib/openapi3_parser/array_sentence.rb
openapi3_parser-0.9.0 lib/openapi3_parser/array_sentence.rb