Module: Compel::Builder::Common
- Included in:
- Schema
- Defined in:
- lib/compel/builder/common.rb
Instance Method Summary collapse
- #default(value, options = {}) ⇒ Object
- #is(value, options = {}) ⇒ Object
- #length(value, options = {}) ⇒ Object
- #max_length(value, options = {}) ⇒ Object
- #min_length(value, options = {}) ⇒ Object
- #required(options = {}) ⇒ Object
Instance Method Details
#default(value, options = {}) ⇒ Object
14 15 16 |
# File 'lib/compel/builder/common.rb', line 14 def default(value, = {}) build_option :default, Coercion.coerce!(value, self.type), end |
#is(value, options = {}) ⇒ Object
6 7 8 |
# File 'lib/compel/builder/common.rb', line 6 def is(value, = {}) build_option :is, Coercion.coerce!(value, self.type), end |
#length(value, options = {}) ⇒ Object
18 19 20 |
# File 'lib/compel/builder/common.rb', line 18 def length(value, = {}) build_option :length, Coercion.coerce!(value, Coercion::Integer), end |
#max_length(value, options = {}) ⇒ Object
26 27 28 |
# File 'lib/compel/builder/common.rb', line 26 def max_length(value, = {}) build_option :max_length, Coercion.coerce!(value, Coercion::Integer), end |
#min_length(value, options = {}) ⇒ Object
22 23 24 |
# File 'lib/compel/builder/common.rb', line 22 def min_length(value, = {}) build_option :min_length, Coercion.coerce!(value, Coercion::Integer), end |
#required(options = {}) ⇒ Object
10 11 12 |
# File 'lib/compel/builder/common.rb', line 10 def required( = {}) build_option :required, true, end |