Class: Compel::Builder::DateTime

Inherits:
Schema
  • Object
show all
Includes:
CommonValue
Defined in:
lib/compel/builder/datetime.rb

Instance Attribute Summary

Attributes inherited from Schema

#options, #type

Instance Method Summary collapse

Methods included from CommonValue

#coerce_value!, #coerce_values_ary!, #in, #max, #min, #raise_array_error, #raise_array_values_error, #raise_value_error, #range

Methods inherited from Schema

#build_option, #default_options, #default_value, human_name, #required?, #validate

Methods included from Common

#coerce_if_proc, #default, #if, #is, #length, #max_length, #min_length, #required

Constructor Details

#initializeDateTime

Returns a new instance of DateTime.



8
9
10
# File 'lib/compel/builder/datetime.rb', line 8

def initialize
  super(Coercion::DateTime)
end

Instance Method Details

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



12
13
14
# File 'lib/compel/builder/datetime.rb', line 12

def format(value, options = {})
  build_option :format, value, options
end

#iso8601(options = {}) ⇒ Object



16
17
18
# File 'lib/compel/builder/datetime.rb', line 16

def iso8601(options = {})
  build_option :format, '%FT%T', options
end