Sha256: b94a0276a16ee96d84635f880f777413d668c3d033b7fa275158929a979e3165

Contents?: true

Size: 731 Bytes

Versions: 2

Compression:

Stored size: 731 Bytes

Contents

module Compel
  module Builder

    module Common

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

      def required
        options[:required] = true
        self
      end

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

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

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

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

    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
compel-0.4.0 lib/compel/builder/common.rb
compel-0.3.7 lib/compel/builder/common.rb