Class: Gtin2atc::Options
- Inherits:
-
Object
- Object
- Gtin2atc::Options
- Defined in:
- lib/gtin2atc/options.rb
Instance Attribute Summary collapse
-
#opts ⇒ Object
readonly
Returns the value of attribute opts.
-
#parser ⇒ Object
readonly
Returns the value of attribute parser.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Options
constructor
A new instance of Options.
Constructor Details
#initialize ⇒ Options
Returns a new instance of Options.
33 34 35 36 37 38 39 40 |
# File 'lib/gtin2atc/options.rb', line 33 def initialize @parser = OptionParser.new @opts = Options.default_opts @parser.on('--log') {|v| @opts[:log] = true } @parser.on('--compare') {|v| @opts[:compare] = true } @parser.on('--full') {|v| @opts[:full] = true } @parser.on_tail('-h', '--help') { puts Options.help; exit } end |
Instance Attribute Details
#opts ⇒ Object (readonly)
Returns the value of attribute opts.
7 8 9 |
# File 'lib/gtin2atc/options.rb', line 7 def opts @opts end |
#parser ⇒ Object (readonly)
Returns the value of attribute parser.
7 8 9 |
# File 'lib/gtin2atc/options.rb', line 7 def parser @parser end |
Class Method Details
.default_opts ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/gtin2atc/options.rb', line 8 def Options.default_opts { :log => false, :compare => false, :full => false, } end |
.help ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/gtin2atc/options.rb', line 15 def Options.help <<EOS #$0 ver.#{Gtin2atc::VERSION} Usage: gtin2atc [--compare] [--log] [file_with_gtin or gtin or pharmacode] [gtin..] If file_with_gtin is given only the GTIN (or pharamacode) (one per line) is outputted. If no file or gtin is given, alle GTIN will be processed. --log log important actions --compare download an compare GTIN/ATC_code from BAG, SwissIndex and RefData For each GTIN we will output a message if it can be only found in the * BAG http://bag.e-mediat.net/SL2007.Web.External/File.axd?file=XMLPublications.zip * SwissIndex e-mediat: http://swissindex.e-mediat.net/SwissindexPharma_out_V101 * or if the ATC_Code does not not match -- full if --compare and --full given produce 15 detailed report files -h, --help Show this help message. EOS end |