Module: SanitizedAttributes
- Defined in:
- lib/sanitized_attributes.rb,
lib/sanitized_attributes/sanitized_attribute.rb
Defined Under Namespace
Modules: ClassMethods
Classes: SanitizedAttribute
Class Method Summary
collapse
Class Method Details
.add_option(name, &blk) ⇒ Object
13
14
15
16
17
|
# File 'lib/sanitized_attributes.rb', line 13
def add_option(name, &blk)
@option_transforms = nil
@options ||= {}
@options[name] = blk
end
|
.add_profile(name, options = {}) ⇒ Object
19
20
21
22
|
# File 'lib/sanitized_attributes.rb', line 19
def add_profile(name, options = {})
@profiles ||= {}
@profiles[name] = options
end
|
.included(into) ⇒ Object
7
8
9
|
# File 'lib/sanitized_attributes.rb', line 7
def self.included(into)
into.extend(ClassMethods)
end
|
.profile(name) ⇒ Object
24
25
26
27
|
# File 'lib/sanitized_attributes.rb', line 24
def profile(name)
@profiles ||= {}
@profiles[name] || {}
end
|
.sanitize_options(options) ⇒ Object
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/sanitized_attributes.rb', line 29
def sanitize_options(options)
pr =
if options.kind_of?(Symbol)
profile(options)
else
options
end
o = merge_options(default_profile, pr)
o
end
|