Module: IiifPrint::IiifManifestPresenter::DisplayImagePresenterDecorator

Defined in:
app/presenters/iiif_print/iiif_manifest_presenter/display_image_presenter_decorator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#base_urlObject

Hyrax defines attr_writer :hostname but not the reader; we add the full accessor.



5
6
7
# File 'app/presenters/iiif_print/iiif_manifest_presenter/display_image_presenter_decorator.rb', line 5

def base_url
  @base_url
end

Instance Method Details

#abilityObject

The three methods below are defined directly on DisplayImagePresenter in recent Hyrax. We keep them here as fallbacks for older Hyrax versions via ‘super rescue NoMethodError`:

- Recent Hyrax: super succeeds silently, no deprecation noise.
- Older Hyrax:  super raises NoMethodError, deprecation fires, fallback value returned.

These fallbacks will be removed in the next major version of iiif_print.



13
14
15
16
17
18
19
20
21
# File 'app/presenters/iiif_print/iiif_manifest_presenter/display_image_presenter_decorator.rb', line 13

def ability
  super
rescue NoMethodError
  Deprecation.warn(self.class,
    "IiifPrint is providing #ability as a fallback for older Hyrax versions. " \
    "This fallback will be removed in the next major iiif_print version — " \
    "please upgrade to a version of Hyrax that defines this method on DisplayImagePresenter.")
  @ability ||= Hyrax::IiifManifestPresenter::NullAbility.new
end

#hostnameObject



23
24
25
26
27
28
29
30
31
# File 'app/presenters/iiif_print/iiif_manifest_presenter/display_image_presenter_decorator.rb', line 23

def hostname
  super
rescue NoMethodError
  Deprecation.warn(self.class,
    "IiifPrint is providing #hostname as a fallback for older Hyrax versions. " \
    "This fallback will be removed in the next major iiif_print version — " \
    "please upgrade to a version of Hyrax that defines this method on DisplayImagePresenter.")
  @hostname || 'localhost'
end

#work?Boolean

Returns:

  • (Boolean)


33
34
35
36
37
38
39
40
41
# File 'app/presenters/iiif_print/iiif_manifest_presenter/display_image_presenter_decorator.rb', line 33

def work?
  super
rescue NoMethodError
  Deprecation.warn(self.class,
    "IiifPrint is providing #work? as a fallback for older Hyrax versions. " \
    "This fallback will be removed in the next major iiif_print version — " \
    "please upgrade to a version of Hyrax that defines this method on DisplayImagePresenter.")
  false
end