Class: Halation::Roll

Inherits:
Object
  • Object
show all
Defined in:
lib/halation/roll.rb,
lib/halation/roll/frame.rb

Overview

Settings for a roll of film.

Defined Under Namespace

Classes: Frame

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRoll

Returns a new instance of Roll.



27
28
29
# File 'lib/halation/roll.rb', line 27

def initialize
  reset
end

Instance Attribute Details

#artistObject (readonly)

Artist for the roll of film.



9
10
11
# File 'lib/halation/roll.rb', line 9

def artist
  @artist
end

#cameraObject (readonly)

Tag of the cameara used.



19
20
21
# File 'lib/halation/roll.rb', line 19

def camera
  @camera
end

Copyright for the roll of film.



11
12
13
# File 'lib/halation/roll.rb', line 11

def copyright
  @copyright
end

#date_capturedObject (readonly)

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



14
15
16
# File 'lib/halation/roll.rb', line 14

def date_captured
  @date_captured
end

#date_scannedObject (readonly)

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



17
18
19
# File 'lib/halation/roll.rb', line 17

def date_scanned
  @date_scanned
end

#framesObject (readonly)

Array of frames on the roll of film.



25
26
27
# File 'lib/halation/roll.rb', line 25

def frames
  @frames
end

#isoObject (readonly)

ISO of the roll of film.



23
24
25
# File 'lib/halation/roll.rb', line 23

def iso
  @iso
end

#lensObject (readonly)

Tag of the default lens used (optional).



21
22
23
# File 'lib/halation/roll.rb', line 21

def lens
  @lens
end

Instance Method Details

#load_file(file_path) ⇒ Object

Load the settings from a YAML file.



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# 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

#resetObject

Reset the configuration to default values.



32
33
34
35
36
37
38
39
40
41
# 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