Sha256: ea5988e855af6988be075c9ec2896a31c972d078b068b9392185e9bc26220471
Contents?: true
Size: 707 Bytes
Versions: 30
Compression:
Stored size: 707 Bytes
Contents
# frozen_string_literal: true module Cmdlet # Array handling routines, eg. join, join_prefix, join_post module Array # JoinPost: join an array of values with separator as a string and using the separator at the end of string class JoinPost < Cmdlet::BaseCmdlet # # @param [String|Int] values - array of values to join # @param [String] separator - separator between values, defaults to comma # @return [String] def call(values, separator = ',') return '' if values.nil? || !values.is_a?(::Array) values = values.reject(&:blank?) return '' if values.length.zero? "#{values.join(separator)}#{separator}" end end end end
Version data entries
30 entries across 30 versions & 1 rubygems