Class: Cmdlet::Array::JoinPre
- Inherits:
-
BaseCmdlet
- Object
- BaseCmdlet
- Cmdlet::Array::JoinPre
- Defined in:
- lib/cmdlet/array/join_pre.rb
Overview
JoinPre: join an array of values with separator as a string and using the separator at the beginning of string
Instance Method Summary collapse
Methods inherited from BaseCmdlet
Instance Method Details
#call(values, separator = ',') ⇒ String
12 13 14 15 16 17 18 19 |
# File 'lib/cmdlet/array/join_pre.rb', line 12 def call(values, separator = ',') return '' if values.nil? || !values.is_a?(::Array) values = values.reject(&:blank?) return '' if values.length.zero? "#{separator}#{values.join(separator)}" end |