Class: Riiif::File
- Inherits:
-
Object
- Object
- Riiif::File
- Defined in:
- app/models/riiif/file.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#extract(transformation, image_info = info) ⇒ String
The processed image data.
- #info ⇒ Object
- #info_extractor ⇒ Object
-
#initialize(input_path, tempfile = nil) ⇒ File
constructor
A new instance of File.
- #transformer ⇒ Object
Constructor Details
#initialize(input_path, tempfile = nil) ⇒ File
Returns a new instance of File.
10 11 12 13 |
# File 'app/models/riiif/file.rb', line 10 def initialize(input_path, tempfile = nil) @path = input_path @tempfile = tempfile # ensures that the tempfile will stick around until this file is garbage collected. end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
3 4 5 |
# File 'app/models/riiif/file.rb', line 3 def path @path end |
Instance Method Details
#extract(transformation, image_info = info) ⇒ String
Returns the processed image data.
18 19 20 |
# File 'app/models/riiif/file.rb', line 18 def extract(transformation, image_info = info) transformer.transform(path, image_info, transformation) end |
#info ⇒ Object
30 31 32 |
# File 'app/models/riiif/file.rb', line 30 def info @info ||= info_extractor.extract end |
#info_extractor ⇒ Object
34 35 36 |
# File 'app/models/riiif/file.rb', line 34 def info_extractor @info_extractor ||= info_extractor_class.new(path) end |
#transformer ⇒ Object
22 23 24 25 26 27 28 |
# File 'app/models/riiif/file.rb', line 22 def transformer if Riiif.kakadu_enabled? && path.ends_with?('.jp2') KakaduTransformer else ImagemagickTransformer end end |