Class: IIIFManifest::Configuration
- Inherits:
-
Object
- Object
- IIIFManifest::Configuration
- Defined in:
- lib/iiif_manifest/configuration.rb
Overview
Handles configuration for the IIIFManifest gem
Constant Summary collapse
- DEFAULT_MANIFEST_PROPERTY_TO_RECORD_METHOD_NAME_MAP =
{ summary: :description, # for V3 manifests description: :description, # for V2 manifests label: :to_s, rights: :rights_statement, homepage: :homepage }.freeze
Instance Attribute Summary collapse
-
#manifest_property_to_record_method_name_map ⇒ Hash<Symbol, Symbol>
Used to map a record’s public method to a manifest property.
-
#manifest_thumbnail ⇒ Boolean
Used to configure whether or not to show the manifest thumbnail property.
-
#max_edge_for_thumbnail ⇒ Integer
Used to set max edge length for thumbnail generation.
Instance Method Summary collapse
Instance Attribute Details
#manifest_property_to_record_method_name_map ⇒ Hash<Symbol, Symbol>
Used to map a record’s public method to a manifest property.
27 28 29 30 |
# File 'lib/iiif_manifest/configuration.rb', line 27 def manifest_property_to_record_method_name_map # the constant is frozen but we need to be able to configure something unfrozen @manifest_property_to_record_method_name_map ||= DEFAULT_MANIFEST_PROPERTY_TO_RECORD_METHOD_NAME_MAP.dup end |
#manifest_thumbnail ⇒ Boolean
Used to configure whether or not to show the manifest thumbnail property.
45 46 47 48 |
# File 'lib/iiif_manifest/configuration.rb', line 45 def manifest_thumbnail return @manifest_thumbnail unless @manifest_thumbnail.nil? @manifest_thumbnail = true end |
#max_edge_for_thumbnail ⇒ Integer
Used to set max edge length for thumbnail generation.
37 38 39 40 |
# File 'lib/iiif_manifest/configuration.rb', line 37 def max_edge_for_thumbnail return @max_edge_for_thumbnail unless @max_edge_for_thumbnail.nil? @max_edge_for_thumbnail = 200 end |
Instance Method Details
#manifest_value_for(record, property:) ⇒ NilClass, #to_s
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.
56 57 58 59 60 |
# File 'lib/iiif_manifest/configuration.rb', line 56 def manifest_value_for(record, property:) method_name = map_property_to_method_name(property: property) return nil unless record.respond_to?(method_name) record.public_send(method_name) end |