Sha256: 49168b1881cb023beae19183ea7ab6f56af1c0ea8a8d04e3fb84f089dac10823

Contents?: true

Size: 387 Bytes

Versions: 8

Compression:

Stored size: 387 Bytes

Contents

# frozen_string_literal: true

module Praxis
  module Types
    class SplattableStringArray < Attributor::Collection
      # Make a type, to allow to load the value, as s single string, if it isn't a numerable
      # This way we can do displayable: 'foobar' , or displayable: ['one', 'two']
      def self.decode_string(value, _context)
        Array(value)
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
praxis-2.0.0 lib/praxis/types/splattable_string_array.rb
praxis-2.0.pre.40 lib/praxis/types/splattable_string_array.rb
praxis-2.0.pre.39 lib/praxis/types/splattable_string_array.rb
praxis-2.0.pre.38 lib/praxis/types/splattable_string_array.rb
praxis-2.0.pre.37 lib/praxis/types/splattable_string_array.rb
praxis-2.0.pre.36 lib/praxis/types/splattable_string_array.rb
praxis-2.0.pre.35 lib/praxis/types/splattable_string_array.rb
praxis-2.0.pre.34 lib/praxis/types/splattable_string_array.rb