Module: Sanitized::Base
- Defined in:
- lib/sanitized/base.rb
Overview
Base methods for all Sanitized classes
Instance Method Summary collapse
-
#cast(value) ⇒ Object
sanitize the value according to the options provided on initialization.
-
#options ⇒ Object
public reader for set options.
Instance Method Details
#cast(value) ⇒ Object
sanitize the value according to the options provided on initialization.
13 14 15 16 17 18 19 20 |
# File 'lib/sanitized/base.rb', line 13 def cast(value) # :nodoc: val = super val = sanitize(val) val = @block.call(val) if @block.present? return val rescue nil end |
#options ⇒ Object
public reader for set options
25 26 27 |
# File 'lib/sanitized/base.rb', line 25 def @options ||= [] end |