class Gtin2atc::Options

Attributes

opts[R]
parser[R]

Public Class Methods

default_opts() click to toggle source
# File lib/gtin2atc/options.rb, line 8
def Options.default_opts
  {
    :log          => false,
    :compare      => false,
    :full         => false,
  }
end
help() click to toggle source
# 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] [output_file]
    If file_with_gtin is given only the GTIN (or pharamacode) (one per line) is outputted.
    If a second parameter output_file is given the name of the generated csv file.
    If no file or gtin is given, alle GTIN will be processed.
    If a file oddb_calc.xml (produced via oddb2xml --calc) is found in the current directory,
    its content is read to add the daily drug dose and dose information for each article.

    --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
new() click to toggle source
# File lib/gtin2atc/options.rb, line 37
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