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



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

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



41
42
43
# File 'lib/filmrolls/negative.rb', line 41

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

#date=(val) ⇒ Object



56
57
58
# File 'lib/filmrolls/negative.rb', line 56

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

#film=(val) ⇒ Object



52
53
54
# File 'lib/filmrolls/negative.rb', line 52

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

#lens=(val) ⇒ Object



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

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



45
46
47
48
49
50
# File 'lib/filmrolls/negative.rb', line 45

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

#save!Object



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

def save!
  @file.save!
end

#shutter_speed=(val) ⇒ Object



37
38
39
# File 'lib/filmrolls/negative.rb', line 37

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

#speed=(val) ⇒ Object



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

def speed=(val)
  @file[:ISO] = val
end

#to_sObject



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

def to_s
  require 'yaml'
  @file.to_yaml
end