Class: Aperture::Photo
- Inherits:
-
Object
- Object
- Aperture::Photo
- Defined in:
- lib/aperture/photo.rb
Overview
Overview
The Photo object is built from two files (.apmaster and .apfile) for each file imported into an Aperture Library. Photo objects have attributes for the path it was found at. It’s associated Version objects. As well as any Album objects it belongs to and the Project it’s inside. Also it has twxo sets of attribute hashs one from the .apmaster file and the other from the .apfile file.
Instance Attribute Summary collapse
-
#albums ⇒ Object
Returns the value of attribute albums.
-
#file_attributes ⇒ Object
Returns the value of attribute file_attributes.
-
#master_attributes ⇒ Object
Returns the value of attribute master_attributes.
-
#path ⇒ Object
Returns the value of attribute path.
-
#project ⇒ Object
Returns the value of attribute project.
-
#versions ⇒ Object
Returns the value of attribute versions.
Instance Method Summary collapse
-
#initialize(path) ⇒ Photo
constructor
creates a new Photo object give a
path
which is where the directory for the photo and it’s metadata are found on disk. -
#version(n) ⇒ Object
Takes a interger and returns back the Version object that matches the number.
Constructor Details
#initialize(path) ⇒ Photo
creates a new Photo object give a path
which is where the directory for the photo and it’s metadata are found on disk.
14 15 16 17 18 19 |
# File 'lib/aperture/photo.rb', line 14 def initialize(path) @path = path raise ArgumentError, "Requires valid directory path" unless File.directory?(@path) @versions = [] @albums = [] end |
Instance Attribute Details
#albums ⇒ Object
Returns the value of attribute albums.
10 11 12 |
# File 'lib/aperture/photo.rb', line 10 def albums @albums end |
#file_attributes ⇒ Object
Returns the value of attribute file_attributes.
10 11 12 |
# File 'lib/aperture/photo.rb', line 10 def file_attributes @file_attributes end |
#master_attributes ⇒ Object
Returns the value of attribute master_attributes.
10 11 12 |
# File 'lib/aperture/photo.rb', line 10 def master_attributes @master_attributes end |
#path ⇒ Object
Returns the value of attribute path.
10 11 12 |
# File 'lib/aperture/photo.rb', line 10 def path @path end |
#project ⇒ Object
Returns the value of attribute project.
10 11 12 |
# File 'lib/aperture/photo.rb', line 10 def project @project end |
#versions ⇒ Object
Returns the value of attribute versions.
10 11 12 |
# File 'lib/aperture/photo.rb', line 10 def versions @versions end |
Instance Method Details
#version(n) ⇒ Object
Takes a interger and returns back the Version object that matches the number
22 23 24 |
# File 'lib/aperture/photo.rb', line 22 def version(n) return @versions.select {|v| v.filename == "Version-#{n}.apversion"}.first end |