Module: Foobara::DetachedEntity::Concerns::Initialization
- Includes:
- Concern
- Included in:
- Foobara::DetachedEntity
- Defined in:
- foobara-0.0.125/projects/detached_entity/src/concerns/initialization.rb
Defined Under Namespace
Modules: ClassMethods
Constant Summary collapse
- ALLOWED_OPTIONS =
Model::ALLOWED_OPTIONS + [:unloaded]
Instance Method Summary collapse
Methods included from Concern
foobara_class_methods_module_for, foobara_concern?, included
Instance Method Details
#initialize(attributes = nil, options = {}) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'foobara-0.0.125/projects/detached_entity/src/concerns/initialization.rb', line 19 def initialize(attributes = nil, = {}) = .keys - ALLOWED_OPTIONS unless .empty? # :nocov: raise ArgumentError, "Invalid options #{} expected only #{ALLOWED_OPTIONS}" # :nocov: end if [:unloaded] = .except(:unloaded) unless .key?(:validate) [:validate] = false end unless .key?(:skip_validations) [:skip_validations] = true end unless .key?(:ignore_unexpected_attributes) [:ignore_unexpected_attributes] = false end unless .key?(:mutable) [:mutable] = false end super self.is_loaded = false else super self.is_loaded = true end end |