Class: Hydra::Works::AddFileToFileSet::Updater

Inherits:
Object
  • Object
show all
Defined in:
lib/hydra/works/services/add_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.



26
27
28
29
# File 'lib/hydra/works/services/add_file_to_file_set.rb', line 26

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.



24
25
26
# File 'lib/hydra/works/services/add_file_to_file_set.rb', line 24

def current_file
  @current_file
end

#file_setObject (readonly)

Returns the value of attribute file_set.



24
25
26
# File 'lib/hydra/works/services/add_file_to_file_set.rb', line 24

def file_set
  @file_set
end

Instance Method Details

#update(file) ⇒ 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



33
34
35
36
# File 'lib/hydra/works/services/add_file_to_file_set.rb', line 33

def update(file)
  attach_attributes(file)
  persist
end