Class: ActiveFedora::SolrInstanceLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/active_fedora/solr_instance_loader.rb

Overview

Responsible for loading an ActiveFedora::Base proxy from a Solr document.

Instance Method Summary collapse

Constructor Details

#initialize(context, id, solr_doc = nil) ⇒ SolrInstanceLoader


12
13
14
15
16
17
# File 'lib/active_fedora/solr_instance_loader.rb', line 12

def initialize(context, id, solr_doc = nil)
  @context = context
  @id = id
  @solr_doc = solr_doc
  validate_solr_doc_and_id!(@solr_doc)
end

Instance Method Details

#objectObject


19
20
21
22
23
24
25
# File 'lib/active_fedora/solr_instance_loader.rb', line 19

def object
  return @object if @object
  @object = allocate_object
  @object.readonly!
  @object.freeze
  @object
end