Class: Catalogage::Fichier

Inherits:
Object
  • Object
show all
Defined in:
lib/images/catalogage/fichier.rb

Overview

Fichier

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, extension, date_extraite, exif, nom_attribue = nil) ⇒ Fichier

Returns a new instance of Fichier.



13
14
15
16
17
18
19
20
# File 'lib/images/catalogage/fichier.rb', line 13

def initialize(path, extension, date_extraite, exif, nom_attribue = nil)
  @date_extraite = date_extraite
  @path = path
  @extension = extension
  @type = Classification.get_type(extension)
  @exif = exif
  @nom_attribue = nom_attribue
end

Instance Attribute Details

#date_extraiteObject (readonly)

Returns the value of attribute date_extraite.



11
12
13
# File 'lib/images/catalogage/fichier.rb', line 11

def date_extraite
  @date_extraite
end

#exifObject (readonly)

Returns the value of attribute exif.



11
12
13
# File 'lib/images/catalogage/fichier.rb', line 11

def exif
  @exif
end

#extensionObject (readonly)

Returns the value of attribute extension.



11
12
13
# File 'lib/images/catalogage/fichier.rb', line 11

def extension
  @extension
end

#nom_attribue=(value) ⇒ Object (writeonly)

Sets the attribute nom_attribue

Parameters:

  • value

    the value to set the attribute nom_attribue to.



10
11
12
# File 'lib/images/catalogage/fichier.rb', line 10

def nom_attribue=(value)
  @nom_attribue = value
end

#pathObject (readonly)

Returns the value of attribute path.



11
12
13
# File 'lib/images/catalogage/fichier.rb', line 11

def path
  @path
end

Instance Method Details

#path_destinationObject



22
23
24
25
26
27
28
29
# File 'lib/images/catalogage/fichier.rb', line 22

def path_destination
  if !@date_extraite.nil?
    "#{@date_extraite.year}/#{format("%02d",
                                     @date_extraite.month)}/#{DirectoryHelpers.defini_dossier_par(@extension)}"
  else
    "none/#{DirectoryHelpers.defini_dossier_par(@extension)}"
  end
end

#path_nouveau_nom(destination) ⇒ Object



31
32
33
# File 'lib/images/catalogage/fichier.rb', line 31

def path_nouveau_nom(destination)
  "#{destination}/#{@nom_attribue}#{@extension.downcase}"
end