Sha256: a94011fd8047c7ee354cd7bc3030f428ea338eeff44330d5cd1c3e8a72babe25

Contents?: true

Size: 442 Bytes

Versions: 4

Compression:

Stored size: 442 Bytes

Contents

module Compel
  module Builder

    class Array < Schema

      def initialize
        super(Coercion::Array)
      end

      def items(schema)
        if !schema.is_a?(Schema)
          raise Compel::TypeError, '#items must be a valid Schema'
        end

        options[:items] = schema
        self
      end

      def is(value)
        options[:is] = Coercion.coerce!(value, Coercion::Array)
        self
      end

    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
compel-0.4.0 lib/compel/builder/array.rb
compel-0.3.7 lib/compel/builder/array.rb
compel-0.3.6 lib/compel/builder/array.rb
compel-0.3.4 lib/compel/builder/array.rb