Sha256: 098fce583fd0120605e4ff09658b6f357467b4d1828f6d9102ff1ffa533b0536
Contents?: true
Size: 583 Bytes
Versions: 4
Compression:
Stored size: 583 Bytes
Contents
require 'active_support/concern' require 'active_support/inflector' module Ripple module EmbeddedDocument # @private module Finders extend ActiveSupport::Concern module ClassMethods def instantiate(attrs) begin klass = attrs['_type'].present? ? attrs.delete('_type').constantize : self rescue NameError klass = self end klass.new.tap do |object| object.raw_attributes = attrs object.changed_attributes.clear end end end end end end
Version data entries
4 entries across 4 versions & 3 rubygems