Sha256: ac3f70b1ec4803c3cda68178524c28f6ad2cba5bd6ded5738763bab3b550ee3c

Contents?: true

Size: 235 Bytes

Versions: 6

Compression:

Stored size: 235 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

6 entries across 6 versions & 1 rubygems

Version Path
openapi3_parser-0.7.0 lib/openapi3_parser/array_sentence.rb
openapi3_parser-0.6.1 lib/openapi3_parser/array_sentence.rb
openapi3_parser-0.6.0 lib/openapi3_parser/array_sentence.rb
openapi3_parser-0.5.2 lib/openapi3_parser/array_sentence.rb
openapi3_parser-0.5.1 lib/openapi3_parser/array_sentence.rb
openapi3_parser-0.5.0 lib/openapi3_parser/array_sentence.rb