Sha256: 4f5510d19e1a013828562c49c331b53c73f56bfb082000910b181d474dc415bc

Contents?: true

Size: 514 Bytes

Versions: 3

Compression:

Stored size: 514 Bytes

Contents

module Compel
  module Builder

    class String < Schema

      include CommonValue

      def initialize
        super(Coercion::String)
      end

      def format(regex)
        options[:format] = Coercion.coerce!(regex, ::Regexp)
        self
      end

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

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

    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
compel-0.3.2 lib/compel/builder/string.rb
compel-0.3.1 lib/compel/builder/string.rb
compel-0.2.0 lib/compel/builder/string.rb