Class: PhotoUtils::Tools::Reciprocity

Inherits:
PhotoUtils::Tool show all
Defined in:
lib/photo_utils/tools/reciprocity.rb

Instance Method Summary collapse

Methods inherited from PhotoUtils::Tool

#description, #initialize, #name

Constructor Details

This class inherits a constructor from PhotoUtils::Tool

Instance Method Details

#runObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/photo_utils/tools/reciprocity.rb', line 17

def run
  if @args.first
    r = @args.first.split('-', 2).map { |n| n ? n.to_i : nil }
  else
    r = 1..100
  end
  range = Range.new(r.first, r.last)
  ti = range.first
  until ti > range.last
    tc = Time.new(ti).reciprocity
    puts "#{ti} => #{tc.round.to_i}"
    ti *= 2
  end
end

#usageObject



9
10
11
12
13
14
15
# File 'lib/photo_utils/tools/reciprocity.rb', line 9

def usage
  %q{
    -r 1      compute single value
    -r 2-60   compute values of 2 to 60
    -r        compute default range of 1-100 secs
  }
end