Module: IiifPrint::SolrDocumentDecorator

Defined in:
app/models/concerns/iiif_print/solr_document_decorator.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args, &block) ⇒ Object



9
10
11
12
# File 'app/models/concerns/iiif_print/solr_document_decorator.rb', line 9

def method_missing(method_name, *args, &block)
  super unless iiif_print_solr_field_names.include? method_name.to_s
  self[IiifPrint.solr_name(method_name.to_s)]
end

Instance Method Details

#any_highlighting?Boolean



25
26
27
# File 'app/models/concerns/iiif_print/solr_document_decorator.rb', line 25

def any_highlighting?
  response&.[]('highlighting')&.[](id)&.present?
end

#digest_sha1Object



5
6
7
# File 'app/models/concerns/iiif_print/solr_document_decorator.rb', line 5

def digest_sha1
  digest[/urn:sha1:([\w]+)/, 1]
end

#file_set_idsObject



19
20
21
22
23
# File 'app/models/concerns/iiif_print/solr_document_decorator.rb', line 19

def file_set_ids
  # Yes, this looks a little odd.  But the truth is the prior key (e.g. `file_set_ids_ssim`) was
  # an alias of `member_ids_ssim`.
  self['member_ids_ssim']
end

#respond_to_missing?(method_name, include_private = false) ⇒ Boolean



14
15
16
# File 'app/models/concerns/iiif_print/solr_document_decorator.rb', line 14

def respond_to_missing?(method_name, include_private = false)
  iiif_print_solr_field_names.include?(method_name.to_s) || super
end

#solr_documentObject



29
30
31
# File 'app/models/concerns/iiif_print/solr_document_decorator.rb', line 29

def solr_document
  self
end