Sha256: a2809fda97e410364bb75268eb6a0f1fc48da2a656033a5e4bede8e07f1c8662

Contents?: true

Size: 433 Bytes

Versions: 5

Compression:

Stored size: 433 Bytes

Contents

module SoberSwag
  class Types
    ##
    # An array that will be parsed from comma-separated values in a string, if given a string.
    module CommaArray
      def self.of(other)
        SoberSwag::Types::Array.of(other).constructor { |val|
          if val.is_a?(::String)
            val.split(',').map(&:strip)
          else
            val
          end
        }.meta(style: :form, explode: false)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
sober_swag-0.19.0 lib/sober_swag/types/comma_array.rb
sober_swag-0.18.0 lib/sober_swag/types/comma_array.rb
sober_swag-0.17.0 lib/sober_swag/types/comma_array.rb
sober_swag-0.16.0 lib/sober_swag/types/comma_array.rb
sober_swag-0.15.0 lib/sober_swag/types/comma_array.rb