Class: Hyrax::RiiifFile
- Inherits:
-
Riiif::File
- Object
- Riiif::File
- Hyrax::RiiifFile
- Includes:
- ActiveSupport::Benchmarkable
- Defined in:
- lib/generators/hyrax/templates/config/initializers/riiif.rb
Overview
Adds file locking to Riiif::File
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Instance Method Summary collapse
-
#extract(transformation, image_info = nil) ⇒ Object
Wrap extract in a read lock and benchmark it.
-
#initialize(input_path, tempfile = nil, id:) ⇒ RiiifFile
constructor
A new instance of RiiifFile.
Constructor Details
#initialize(input_path, tempfile = nil, id:) ⇒ RiiifFile
Returns a new instance of RiiifFile.
42 43 44 45 46 |
# File 'lib/generators/hyrax/templates/config/initializers/riiif.rb', line 42 def initialize(input_path, tempfile = nil, id:) super(input_path, tempfile) raise(ArgumentError, "must specify id") if id.blank? @id = id end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
41 42 43 |
# File 'lib/generators/hyrax/templates/config/initializers/riiif.rb', line 41 def id @id end |
Instance Method Details
#extract(transformation, image_info = nil) ⇒ Object
Wrap extract in a read lock and benchmark it
49 50 51 52 53 54 55 |
# File 'lib/generators/hyrax/templates/config/initializers/riiif.rb', line 49 def extract(transformation, image_info = nil) Riiif::Image.file_resolver.file_locks[id].with_read_lock do benchmark "RiiifFile extracted #{path} with #{transformation.to_params}", level: :debug do super end end end |