Class: Hyrax::Riiif::File
- Inherits:
-
Riiif::File
- Object
- Riiif::File
- Hyrax::Riiif::File
- Includes:
- ActiveSupport::Benchmarkable
- Defined in:
- app/models/hyrax/riiif/file.rb,
app/models/hyrax/riiif/file.rb
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 ⇒ File
constructor
A new instance of File.
Constructor Details
#initialize ⇒ File
Returns a new instance of File.
10 11 12 13 14 |
# File 'app/models/hyrax/riiif/file.rb', line 10 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.
8 9 10 |
# File 'app/models/hyrax/riiif/file.rb', line 8 def id @id end |
Instance Method Details
#extract(transformation, image_info = nil) ⇒ Object
Wrap extract in a read lock and benchmark it
17 18 19 20 21 22 23 |
# File 'app/models/hyrax/riiif/file.rb', line 17 def extract(transformation, image_info = nil) ::Riiif::Image.file_resolver.file_locks[id].with_read_lock do benchmark "Hyrax::Riiif::File extracted #{path} with #{transformation.to_params}", level: :debug do super end end end |