Module: BMC::ActiveModelTypeCast::Date

Defined in:
lib/bmc/active_model_type_cast.rb

Constant Summary collapse

SANITIZABLE_FORMATS =

rubocop:disable Style/RegexpLiteral

[
  /^[0-9]{2}\/[0-9]{2}\/[0-9]{4}$/,
  /^[0-9]{4}-[0-9]{2}-[0-9]{2}$/,
]

Instance Method Summary collapse

Instance Method Details

#cast_value(value) ⇒ Object

rubocop:enable Style/RegexpLiteral



20
21
22
23
24
25
26
# File 'lib/bmc/active_model_type_cast.rb', line 20

def cast_value(value)
  if sanitizable?(value)
    super(sanitize(value))
  else
    super(value)
  end
end