Class: IIIF::Image::URI
- Inherits:
-
Object
- Object
- IIIF::Image::URI
- Defined in:
- lib/iiif/image/models/uri.rb
Overview
Represents a URI to a IIIF image endpoint
Direct Known Subclasses
Instance Attribute Summary collapse
-
#base_uri ⇒ Object
readonly
Returns the value of attribute base_uri.
-
#identifier ⇒ Object
readonly
Returns the value of attribute identifier.
-
#transformation ⇒ Object
readonly
Returns the value of attribute transformation.
Instance Method Summary collapse
-
#initialize(base_uri:, identifier:, transformation: nil) ⇒ URI
constructor
A new instance of URI.
- #to_s ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(base_uri:, identifier:, transformation: nil) ⇒ URI
Returns a new instance of URI.
7 8 9 10 11 |
# File 'lib/iiif/image/models/uri.rb', line 7 def initialize(base_uri:, identifier:, transformation: nil) @base_uri = base_uri @identifier = identifier @transformation = transformation end |
Instance Attribute Details
#base_uri ⇒ Object (readonly)
Returns the value of attribute base_uri.
13 14 15 |
# File 'lib/iiif/image/models/uri.rb', line 13 def base_uri @base_uri end |
#identifier ⇒ Object (readonly)
Returns the value of attribute identifier.
13 14 15 |
# File 'lib/iiif/image/models/uri.rb', line 13 def identifier @identifier end |
#transformation ⇒ Object (readonly)
Returns the value of attribute transformation.
13 14 15 |
# File 'lib/iiif/image/models/uri.rb', line 13 def transformation @transformation end |
Instance Method Details
#to_s ⇒ Object
15 16 17 18 |
# File 'lib/iiif/image/models/uri.rb', line 15 def to_s return to_image_request_uri.to_s if transformation base_uri + identifier + '/info.json' end |
#valid? ⇒ Boolean
20 21 22 23 |
# File 'lib/iiif/image/models/uri.rb', line 20 def valid? return true unless transformation to_image_request_uri.valid? end |