Class: Oddb2xml::Options
- Inherits:
-
Object
- Object
- Oddb2xml::Options
- Defined in:
- lib/oddb2xml/options.rb
Instance Attribute Summary collapse
-
#opts ⇒ Object
readonly
Returns the value of attribute opts.
-
#parser ⇒ Object
readonly
Returns the value of attribute parser.
Instance Method Summary collapse
-
#initialize ⇒ Options
constructor
A new instance of Options.
Constructor Details
#initialize ⇒ Options
Returns a new instance of Options.
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/oddb2xml/options.rb', line 60 def initialize @parser = OptionParser.new @opts = Options.default_opts @parser.on('-a', '--append') {|v| @opts[:nonpharma] = true } @parser.on('-c v', '--compress v', /^tar\.gz|zip$/){|v| @opts[:compress_ext] = v } @parser.on('-e', '--extended') {|v| @opts[:extended] = true @opts[:nonpharma] = true @opts[:price] = :zurrose @opts[:calc] = true } @parser.on('-f v', '--format v', /^xml|dat$/) {|v| @opts[:format] = v.intern } @parser.on('--calc') {|v| @opts[:calc] = true } @parser.on('-o', '--option') {|v| @opts[:fi] = true } @parser.on('-I v', '--increment v', /^[0-9]+$/) {|v| @opts[:percent] = v ? v.to_i : 0 @opts[:price] = :zurrose } @parser.on('-i', '--include') {|v| @opts[:ean14] = true } @parser.on('-t v', '--tag-suffix v', /^[A-z0-9]*$/i) {|v| @opts[:tag_suffix] = v.upcase } @parser.on('-x v', '--context v', /^addr(ess)*$/i){|v| @opts[:address] = true } @parser.on('-p', '--price') {|v| @opts[:price] = :zurrose } @parser.on('--skip-download') {|v| @opts[:skip_download] = true } @parser.on('--log') {|v| @opts[:log] = 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/oddb2xml/options.rb', line 7 def opts @opts end |
#parser ⇒ Object (readonly)
Returns the value of attribute parser.
7 8 9 |
# File 'lib/oddb2xml/options.rb', line 7 def parser @parser end |