Module: Mongoid::Attributes::Processing
- Included in:
- Mongoid::Attributes
- Defined in:
- build/mongoid-7.3/lib/mongoid/attributes/processing.rb
Overview
This module contains the behavior for processing attributes.
Instance Method Summary collapse
-
#process_attributes(attrs = nil) {|_self| ... } ⇒ Object
Process the provided attributes casting them to their proper values if a field exists for them on the document.
Instance Method Details
#process_attributes(attrs = nil) {|_self| ... } ⇒ Object
Process the provided attributes casting them to their proper values if a field exists for them on the document. This will be limited to only the attributes provided in the suppied Hash
so that no extra nil values get put into the document’s attributes.
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'build/mongoid-7.3/lib/mongoid/attributes/processing.rb', line 21 def process_attributes(attrs = nil) attrs ||= {} if !attrs.empty? attrs = sanitize_for_mass_assignment(attrs) attrs.each_pair do |key, value| next if pending_attribute?(key, value) process_attribute(key, value) end end yield self if block_given? process_pending end |