Class: FileConvert::File

Inherits:
Object
  • Object
show all
Defined in:
lib/file_convert/file.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(original_file) ⇒ FileConvert::File

Hold original and conversion



13
14
15
16
17
# File 'lib/file_convert/file.rb', line 13

def initialize(original_file)
  @original_file = original_file
  @data = original_file.data
  @conversions = {}
end

Instance Attribute Details

#conversionsObject (readonly)

Returns the value of attribute conversions.



5
6
7
# File 'lib/file_convert/file.rb', line 5

def conversions
  @conversions
end

#dataObject (readonly)

Returns the value of attribute data.



4
5
6
# File 'lib/file_convert/file.rb', line 4

def data
  @data
end

#original_fileObject (readonly)

Returns the value of attribute original_file.



3
4
5
# File 'lib/file_convert/file.rb', line 3

def original_file
  @original_file
end

Instance Method Details

#add_conversion(mime_type, converted_file) ⇒ FileConvert::File

Adds a new conversion

Parameters:

  • mime_type (String)
  • converted_file (File)

Returns:



26
27
28
# File 'lib/file_convert/file.rb', line 26

def add_conversion(mime_type, converted_file)
  tap { @conversions[mime_type] = converted_file }
end