Class: Valkyrie::Storage::Shrine::DelayedDownload

Inherits:
Object
  • Object
show all
Defined in:
lib/valkyrie/storage/shrine.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(shrine, id) ⇒ DelayedDownload

Returns a new instance of DelayedDownload.



25
26
27
28
# File 'lib/valkyrie/storage/shrine.rb', line 25

def initialize(shrine, id)
  @shrine = shrine
  @id = id
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth_name, *args, &block) ⇒ Object



34
35
36
37
# File 'lib/valkyrie/storage/shrine.rb', line 34

def method_missing(meth_name, *args, &block)
  return super unless file.respond_to?(meth_name)
  file.send(meth_name, *args, &block)
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



24
25
26
# File 'lib/valkyrie/storage/shrine.rb', line 24

def id
  @id
end

#shrineObject (readonly)

Returns the value of attribute shrine.



24
25
26
# File 'lib/valkyrie/storage/shrine.rb', line 24

def shrine
  @shrine
end

Instance Method Details

#fileObject



30
31
32
# File 'lib/valkyrie/storage/shrine.rb', line 30

def file
  @file ||= shrine.open(id)
end

#respond_to_missing?(meth_name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/valkyrie/storage/shrine.rb', line 39

def respond_to_missing?(meth_name, include_private = false)
  file.respond_to?(meth_name) || super
end