# File lib/delayed/psych_ext.rb, line 66 def resolve_class_with_constantize(klass_name) klass_name.constantize rescue resolve_class_without_constantize(klass_name) end
# File lib/delayed/psych_ext.rb, line 33 def visit_Psych_Nodes_Mapping_with_class(object) return revive(Psych.load_tags[object.tag], object) if Psych.load_tags[object.tag] case object.tag when /^!ruby\/class:?(.*)?$/ resolve_class $1 when /^!ruby\/ActiveRecord:(.+)$/ klass = resolve_class($1) payload = Hash[*object.children.map { |c| accept c }] id = payload["attributes"][klass.primary_key] begin if ActiveRecord::VERSION::MAJOR == 3 klass.unscoped.find(id) else # Rails 2 klass.with_exclusive_scope { klass.find(id) } end rescue ActiveRecord::RecordNotFound raise Delayed::DeserializationError end when /^!ruby\/Mongoid:(.+)$/ klass = resolve_class($1) payload = Hash[*object.children.map { |c| accept c }] begin klass.find(payload["attributes"]["_id"]) rescue Mongoid::Errors::DocumentNotFound raise Delayed::DeserializationError end else visit_Psych_Nodes_Mapping_without_class(object) end end
Generated with the Darkfish Rdoc Generator 2.