class Halation::Roll

Settings for a roll of film.

Attributes

artist[R]

Artist for the roll of film.

camera[R]

Tag of the cameara used.

date_captured[R]

Default date a frame was captured for all frames, in ISO 8601 format (optional).

date_scanned[R]

Default date a frame was scanned (digitized) for all frames, in ISO 8601 format (optional).

frames[R]

Array of frames on the roll of film.

iso[R]

ISO of the roll of film.

lens[R]

Tag of the default lens used (optional).

Public Class Methods

new() click to toggle source
# File lib/halation/roll.rb, line 27
def initialize
  reset
end

Public Instance Methods

load_file(file_path) click to toggle source

Load the settings from a YAML file.

# File lib/halation/roll.rb, line 44
def load_file(file_path)
  reset

  YAML.load_file(file_path).tap do |roll|
    @artist = Coerce.string(roll["artist"])
    @copyright = Coerce.string(roll["copyright"])
    @date_captured = Coerce.date(roll["date_captured"])
    @date_scanned = Coerce.date(roll["date_scanned"])
    @camera = Coerce.string(roll["camera"])
    @lens = Coerce.string(roll["lens"])
    @iso = Coerce.integer(roll["iso"])

    (roll["frames"] || []).each do |frame|
      @frames << Frame.new(frame)
    end
  end
end
reset() click to toggle source

Reset the configuration to default values.

# File lib/halation/roll.rb, line 32
def reset
  @artist = nil
  @copyright = nil
  @date_captured = nil
  @date_scanned = nil
  @camera = nil
  @lens = nil
  @iso = nil
  @frames = []
end