Class: Cmdlet::Array::JoinPost
- Inherits:
-
BaseCmdlet
- Object
- BaseCmdlet
- Cmdlet::Array::JoinPost
- Defined in:
- lib/cmdlet/array/join_post.rb
Overview
JoinPost: join an array of values with separator as a string and using the separator at the end 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_post.rb', line 12 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 |