Module: SoberSwag::Types::CommaArray

Defined in:
lib/sober_swag/types/comma_array.rb

Overview

An array that will be parsed from comma-separated values in a string, if given a string.

Class Method Summary collapse

Class Method Details

.of(other) ⇒ SoberSwag::Types::CommaArray

Get a parser that will parse comma-separated values of another type.

Parameters:

  • other (Class)

    a swagger-able type to parse into

Returns:



10
11
12
13
14
15
16
17
18
# File 'lib/sober_swag/types/comma_array.rb', line 10

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