Class: Halation::Roll
- Inherits:
-
Object
- Object
- Halation::Roll
- 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
-
#artist ⇒ Object
readonly
Artist for the roll of film.
-
#camera ⇒ Object
readonly
Tag of the cameara used.
-
#copyright ⇒ Object
readonly
Copyright for the roll of film.
-
#date_captured ⇒ Object
readonly
Default date a frame was captured for all frames, in ISO 8601 format (optional).
-
#date_scanned ⇒ Object
readonly
Default date a frame was scanned (digitized) for all frames, in ISO 8601 format (optional).
-
#frames ⇒ Object
readonly
Array of frames on the roll of film.
-
#iso ⇒ Object
readonly
ISO of the roll of film.
-
#lens ⇒ Object
readonly
Tag of the default lens used (optional).
Instance Method Summary collapse
-
#initialize ⇒ Roll
constructor
A new instance of Roll.
-
#load_file(file_path) ⇒ Object
Load the settings from a YAML file.
-
#reset ⇒ Object
Reset the configuration to default values.
Constructor Details
#initialize ⇒ Roll
Returns a new instance of Roll.
27 28 29 |
# File 'lib/halation/roll.rb', line 27 def initialize reset end |
Instance Attribute Details
#artist ⇒ Object (readonly)
Artist for the roll of film.
9 10 11 |
# File 'lib/halation/roll.rb', line 9 def artist @artist end |
#camera ⇒ Object (readonly)
Tag of the cameara used.
19 20 21 |
# File 'lib/halation/roll.rb', line 19 def camera @camera end |
#copyright ⇒ Object (readonly)
Copyright for the roll of film.
11 12 13 |
# File 'lib/halation/roll.rb', line 11 def copyright @copyright end |
#date_captured ⇒ Object (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_scanned ⇒ Object (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 |
#frames ⇒ Object (readonly)
Array of frames on the roll of film.
25 26 27 |
# File 'lib/halation/roll.rb', line 25 def frames @frames end |
#iso ⇒ Object (readonly)
ISO of the roll of film.
23 24 25 |
# File 'lib/halation/roll.rb', line 23 def iso @iso end |
#lens ⇒ Object (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 |
#reset ⇒ Object
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 |