Module: Compel::Builder::Common

Included in:
Schema
Defined in:
lib/compel/builder/common.rb

Instance Method Summary collapse

Instance Method Details

#default(value, options = {}) ⇒ Object



14
15
16
# File 'lib/compel/builder/common.rb', line 14

def default(value, options = {})
  build_option :default, Coercion.coerce!(value, self.type), options
end

#is(value, options = {}) ⇒ Object



6
7
8
# File 'lib/compel/builder/common.rb', line 6

def is(value, options = {})
  build_option :is, Coercion.coerce!(value, self.type), options
end

#length(value, options = {}) ⇒ Object



18
19
20
# File 'lib/compel/builder/common.rb', line 18

def length(value, options = {})
  build_option :length, Coercion.coerce!(value, Coercion::Integer), options
end

#max_length(value, options = {}) ⇒ Object



26
27
28
# File 'lib/compel/builder/common.rb', line 26

def max_length(value, options = {})
  build_option :max_length, Coercion.coerce!(value, Coercion::Integer), options
end

#min_length(value, options = {}) ⇒ Object



22
23
24
# File 'lib/compel/builder/common.rb', line 22

def min_length(value, options = {})
  build_option :min_length, Coercion.coerce!(value, Coercion::Integer), options
end

#required(options = {}) ⇒ Object



10
11
12
# File 'lib/compel/builder/common.rb', line 10

def required(options = {})
  build_option :required, true, options
end