Class: Hydra::Works::AddExternalFileToFileSet::Updater

Inherits:
Object
  • Object
show all
Defined in:
lib/hydra/works/services/add_external_file_to_file_set.rb

Direct Known Subclasses

VersioningUpdater

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file_set, type, update_existing) ⇒ Updater

Returns a new instance of Updater.



30
31
32
33
# File 'lib/hydra/works/services/add_external_file_to_file_set.rb', line 30

def initialize(file_set, type, update_existing)
  @file_set = file_set
  @current_file = find_or_create_file(type, update_existing)
end

Instance Attribute Details

#current_fileObject (readonly)

Returns the value of attribute current_file.



28
29
30
# File 'lib/hydra/works/services/add_external_file_to_file_set.rb', line 28

def current_file
  @current_file
end

#file_setObject (readonly)

Returns the value of attribute file_set.



28
29
30
# File 'lib/hydra/works/services/add_external_file_to_file_set.rb', line 28

def file_set
  @file_set
end

Instance Method Details

#update(external_file_url, filename = nil) ⇒ Object

None of the attribute description methods are required.

Parameters:

  • file (#read)

    object that will be interrogated using the methods: :path, :original_name, :original_filename, :mime_type, :content_type



37
38
39
40
# File 'lib/hydra/works/services/add_external_file_to_file_set.rb', line 37

def update(external_file_url, filename = nil)
  attach_attributes(external_file_url, filename)
  persist
end