Class: Aperture::Photo

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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.

Raises:

  • (ArgumentError)


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

#albumsObject

Returns the value of attribute albums.



10
11
12
# File 'lib/aperture/photo.rb', line 10

def albums
  @albums
end

#file_attributesObject

Returns the value of attribute file_attributes.



10
11
12
# File 'lib/aperture/photo.rb', line 10

def file_attributes
  @file_attributes
end

#master_attributesObject

Returns the value of attribute master_attributes.



10
11
12
# File 'lib/aperture/photo.rb', line 10

def master_attributes
  @master_attributes
end

#pathObject

Returns the value of attribute path.



10
11
12
# File 'lib/aperture/photo.rb', line 10

def path
  @path
end

#projectObject

Returns the value of attribute project.



10
11
12
# File 'lib/aperture/photo.rb', line 10

def project
  @project
end

#versionsObject

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