Class: Catalogage::Fichier
- Inherits:
-
Object
- Object
- Catalogage::Fichier
- Defined in:
- lib/images/catalogage/fichier.rb
Overview
Fichier
Instance Attribute Summary collapse
-
#date_extraite ⇒ Object
readonly
Returns the value of attribute date_extraite.
-
#exif ⇒ Object
readonly
Returns the value of attribute exif.
-
#extension ⇒ Object
readonly
Returns the value of attribute extension.
-
#nom_attribue ⇒ Object
writeonly
Sets the attribute nom_attribue.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(path, extension, date_extraite, exif, nom_attribue = nil) ⇒ Fichier
constructor
A new instance of Fichier.
- #path_destination ⇒ Object
- #path_nouveau_nom(destination) ⇒ Object
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_extraite ⇒ Object (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 |
#exif ⇒ Object (readonly)
Returns the value of attribute exif.
11 12 13 |
# File 'lib/images/catalogage/fichier.rb', line 11 def exif @exif end |
#extension ⇒ Object (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
10 11 12 |
# File 'lib/images/catalogage/fichier.rb', line 10 def nom_attribue=(value) @nom_attribue = value end |
#path ⇒ Object (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_destination ⇒ Object
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 |