Class: AppConfig
- Inherits:
-
Object
- Object
- AppConfig
- Defined in:
- lib/focusinspector/AppConfig.rb
Overview
Focus Inspector - The focus inspection and lens calibration software.
Copyright (c) 2012 by Chris Schlaeger [email protected]
This program is Open Source software; you can redistribute it and/or modify it under the terms of MIT license as shipped with this software.
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#imageFile ⇒ Object
readonly
Returns the value of attribute imageFile.
-
#viewer ⇒ Object
readonly
Returns the value of attribute viewer.
Instance Method Summary collapse
-
#initialize(args) ⇒ AppConfig
constructor
A new instance of AppConfig.
Constructor Details
#initialize(args) ⇒ AppConfig
Returns a new instance of AppConfig.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/focusinspector/AppConfig.rb', line 15 def initialize(args) @imageFile = nil @command = nil @viewer = 'gwenview' version = IO.read(File.(File.dirname(__FILE__) + "/../../VERSION")).strip opts = OptionParser.new opts. = <<"EOT" Focus Inspector v#{version} (c) Copyright 2012 by Chris Schlaeger Usage: focusinspector [options] <command> <ImageFile> EOT opts.on('--viewer <viewer>', 'Image viewer to use') do |v| @viewer = v end opts.on_tail('-h', '--help', 'Show this message') do puts opts end opts.separator "" opts.separator <<"EOT" Supported commands are: show : Show image with focus points overlay measure : Measure the sharpness of a photo of the test chart list : List some focusing information of the image EOT opts.order! @command = ARGV[0] unless @command Log.error('Command is missing') puts opts end unless %w( show measure list ).include?(command) Log.error("Unknown command #{@command}") puts opts end @imageFile = ARGV[1] unless @imageFile Log.error('Image file name missing.') puts opts end unless File.exists?(@imageFile) Log.error("Cannot find image file #{@imageFile}") end end |
Instance Attribute Details
#command ⇒ Object (readonly)
Returns the value of attribute command.
13 14 15 |
# File 'lib/focusinspector/AppConfig.rb', line 13 def command @command end |
#imageFile ⇒ Object (readonly)
Returns the value of attribute imageFile.
13 14 15 |
# File 'lib/focusinspector/AppConfig.rb', line 13 def imageFile @imageFile end |
#viewer ⇒ Object (readonly)
Returns the value of attribute viewer.
13 14 15 |
# File 'lib/focusinspector/AppConfig.rb', line 13 def viewer @viewer end |