Sha256: 243edb05b18bfe19729ff36faa66795c8db9538dfb2bc636975acfa43c81b54a

Contents?: true

Size: 673 Bytes

Versions: 2

Compression:

Stored size: 673 Bytes

Contents

module Compel
  module Builder

    module Common

      def is(value)
        options[:is] = value
        self
      end

      def required
        options[:required] = true
        self
      end

      def default(value)
        options[:default] = value
        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.3.6 lib/compel/builder/common.rb
compel-0.3.4 lib/compel/builder/common.rb