Class: IiifPrint::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/iiif_print/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#additional_tessearct_optionsString

The additional options to pass to the Tesseract configuration



95
96
97
# File 'lib/iiif_print/configuration.rb', line 95

def additional_tessearct_options
  @additional_tessearct_options || ""
end

#after_create_fileset_handler=(value) ⇒ Object (writeonly)

Sets the attribute after_create_fileset_handler

Parameters:

  • value

    the value to set the attribute after_create_fileset_handler to.



3
4
5
# File 'lib/iiif_print/configuration.rb', line 3

def after_create_fileset_handler=(value)
  @after_create_fileset_handler = value
end

#default_iiif_manifest_versionObject



46
47
48
# File 'lib/iiif_print/configuration.rb', line 46

def default_iiif_manifest_version
  @default_iiif_manifest_version || 2
end

#excluded_model_name_solr_field_keyString

A string of a solr field key

Returns:

  • (String)


40
41
42
43
# File 'lib/iiif_print/configuration.rb', line 40

def excluded_model_name_solr_field_key
  return "human_readable_type_sim" unless defined?(@excluded_model_name_solr_field_key)
  @excluded_model_name_solr_field_key
end

#excluded_model_name_solr_field_valuesArray<String>

By default, this uses an array of human readable types

ex: ['Generic Work', 'Image']

Returns:

  • (Array<String>)


19
20
21
22
# File 'lib/iiif_print/configuration.rb', line 19

def excluded_model_name_solr_field_values
  return @excluded_model_name_solr_field_values unless @excluded_model_name_solr_field_values.nil?
  @excluded_model_name_solr_field_values = []
end

#metadata_fieldsObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

TODO:

To move this to an ‘@api public` state, we need to consider what a proper configuration looks like.

Note:

These fields will appear in rendering order.

rubocop:disable Metrics/MethodLength



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/iiif_print/configuration.rb', line 55

def 
  @metadata_fields ||= {
    title: {},
    description: {},
    collection: {},
    abstract: {},
    date_modified: {},
    creator: { render_as: :faceted },
    contributor: { render_as: :faceted },
    subject: { render_as: :faceted },
    publisher: { render_as: :faceted },
    language: { render_as: :faceted },
    identifier: { render_as: :linked },
    keyword: { render_as: :faceted },
    date_created: { render_as: :linked },
    based_near_label: {},
    related_url: { render_as: :external_link },
    resource_type: { render_as: :faceted },
    source: {},
    extent: {},
    rights_statement: { render_as: :rights_statement },
    rights_notes: {},
    access_right: {},
    license: { render_as: :license },
    searchable_text: {}
  }
end

#sort_iiif_manifest_canvases_byObject



85
86
87
# File 'lib/iiif_print/configuration.rb', line 85

def sort_iiif_manifest_canvases_by
  @sort_iiif_manifest_canvases_by || :title
end

Instance Method Details

#handle_after_create_fileset(file_set, user) ⇒ Object

Parameters:

  • file_set (FileSet)
  • user (User)


7
8
9
10
11
12
13
# File 'lib/iiif_print/configuration.rb', line 7

def handle_after_create_fileset(file_set, user)
  if defined? @after_create_fileset_handler
    @after_create_fileset_handler.call(file_set, user)
  else
    IiifPrint::Data.handle_after_create_fileset(file_set, user)
  end
end

#registered_ingest_dirsArray<String>

This method wraps Hyrax’s configuration so we can sniff out the correct method to use. The Hyrax::Configuration#whitelisted_ingest_dirs is deprecated in favor of Hyrax::Configuration#registered_ingest_dirs.

Returns:

  • (Array<String>)


29
30
31
32
33
34
35
# File 'lib/iiif_print/configuration.rb', line 29

def registered_ingest_dirs
  if Hyrax.config.respond_to?(:registered_ingest_dirs)
    Hyrax.config.registered_ingest_dirs
  else
    Hyrax.config.whitelisted_ingest_dirs
  end
end