Class: Filmrolls::Negative

Inherits:
Object
  • Object
show all
Defined in:
lib/filmrolls/negative.rb

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Negative

Returns a new instance of Negative.



5
6
7
# File 'lib/filmrolls/negative.rb', line 5

def initialize(path)
  @file = Exiftool.new(path, :coord_format => "%.6f degrees")
end

Instance Method Details

#aperture=(val) ⇒ Object



29
30
31
# File 'lib/filmrolls/negative.rb', line 29

def aperture=(val)
  @file[:ApertureValue] = val
end

#camera=(val) ⇒ Object



71
72
73
74
75
76
77
# File 'lib/filmrolls/negative.rb', line 71

def camera=(val)
  make = val.strip.split(/\s+/)[0]
  model = val.strip[(make.length)..-1]
  @file[:LocalizedCameraModel] = val.strip
  @file[:Make] = make.strip
  @file[:Model] = model.strip
end

#changed?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/filmrolls/negative.rb', line 21

def changed?
  @file.changed?
end

#compensation=(val) ⇒ Object



43
44
45
# File 'lib/filmrolls/negative.rb', line 43

def compensation=(val)
  @file[:ExposureCompensation] = val
end

#date=(val) ⇒ Object



58
59
60
# File 'lib/filmrolls/negative.rb', line 58

def date=(val)
  @file[:DateTimeOriginal] = val
end

#film=(val) ⇒ Object



54
55
56
# File 'lib/filmrolls/negative.rb', line 54

def film=(val)
  @file[:UserComment] = val
end

#lens=(val) ⇒ Object



62
63
64
65
66
67
68
69
# File 'lib/filmrolls/negative.rb', line 62

def lens=(val)
  # TODO: this is hacky as f
  make = val.strip.split(/\s+/)[0]
  model = val.strip[(make.length)..-1]
  @file[:Lens] = val.strip
  @file[:LensMake] = make.strip
  @file[:LensModel] = model.strip
end

#merge(*args) ⇒ Object



9
10
11
12
13
14
# File 'lib/filmrolls/negative.rb', line 9

def merge(*args)
  args.each do |key, value|
    method = "#{key}="
    @self.public_send(method, value) if @self.respond_to? method
  end
end

#position=(val) ⇒ Object



47
48
49
50
51
52
# File 'lib/filmrolls/negative.rb', line 47

def position=(val)
  @file[:GPSLatitude] = "#{val.lat} degrees"
  @file[:GPSLatitudeRef] = 'North'
  @file[:GPSLongitude] = "#{val.lng} degrees"
  @file[:GPSLongitudeRef] = 'East'
end

#save!Object



25
26
27
# File 'lib/filmrolls/negative.rb', line 25

def save!
  @file.save!
end

#shutter_speed=(val) ⇒ Object



39
40
41
# File 'lib/filmrolls/negative.rb', line 39

def shutter_speed=(val)
  @file[:ExposureTime] = val
end

#speed=(val) ⇒ Object



33
34
35
36
37
# File 'lib/filmrolls/negative.rb', line 33

def speed=(val)
  @file[:ISO] = val
  @file[:ISOSpeed] = val
  @file[:SensitivityType] = 'ISO Speed'
end

#to_sObject



16
17
18
19
# File 'lib/filmrolls/negative.rb', line 16

def to_s
  require 'yaml'
  @file.to_yaml
end