Sha256: 1295bd3bdaf5a685ef542b275c11ae207ae1a1c794aed61b6ab615bc2d1457b9
Contents?: true
Size: 1.34 KB
Versions: 1
Compression:
Stored size: 1.34 KB
Contents
require 'yaml' require_relative 'coerce' require_relative 'roll/frame' module Halation # Settings for a roll of film. class Roll # Artist for the roll of film. attr_reader :artist # Copyright for the roll of film. attr_reader :copyright # Default date for all frames in ISO 8601 format (optional). attr_reader :date # Tag of the cameara used. attr_reader :camera # Tag of the default lens used (optional). attr_reader :lens # ISO of the roll of film. attr_reader :iso # Array of frames on the roll of film. attr_reader :frames def initialize reset end # Reset the configuration to default values. def reset @artist = nil @copyright = nil @date = nil @camera = nil @lens = nil @iso = nil @frames = [] end # Load the settings from a YAML file. 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 = Coerce.date(roll["date"]) @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 end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
halation-0.2.1 | lib/halation/roll.rb |