Module: AttributesSanitizer::Bundle
- Included in:
- AttributesSanitizer
- Defined in:
- lib/attributes_sanitizer/bundle.rb
Instance Method Summary collapse
Instance Method Details
#bundle(bundle_name) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/attributes_sanitizer/bundle.rb', line 14 def bundle(bundle_name) bundle = @bundles[bundle_name.to_sym] bundle&.map do |sanitizer_name| find(sanitizer_name) end end |
#define_bundle(bundle_name, keys) ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/attributes_sanitizer/bundle.rb', line 4 def define_bundle(bundle_name, keys) raise ArgumentError, 'empty bundle name' if bundle_name.blank? keys = Array(keys) raise ArgumentError, 'empty keys' if keys.blank? @bundles ||= {} @bundles[bundle_name.to_sym] = keys end |