optopus 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/optopus.rb +26 -18
  2. metadata +3 -3
data/lib/optopus.rb CHANGED
@@ -63,38 +63,46 @@ module Optopus
63
63
  (class<<self; self; end).send(:define_method, :evaluate, &block)
64
64
  end
65
65
 
66
- def parse_error(reason)
67
- e = OptionParser::ParseError.new(*@args)
66
+ def parse_error(reason, *args)
67
+ args = @args if args.empty?
68
+ e = OptionParser::ParseError.new(*args)
68
69
  e.reason = reason
69
70
  raise e
70
71
  end
71
72
 
72
- def ambiguous_option
73
- raise OptionParser::AmbiguousOption.new(*@args)
73
+ def ambiguous_option(*args)
74
+ args = @args if args.empty?
75
+ raise OptionParser::AmbiguousOption.new(*args)
74
76
  end
75
77
 
76
- def needless_argument
77
- raise OptionParser::NeedlessArgument.new(*@args)
78
+ def needless_argument(*args)
79
+ args = @args if args.empty?
80
+ raise OptionParser::NeedlessArgument.new(*args)
78
81
  end
79
82
 
80
- def missing_argument
81
- raise OptionParser::MissingArgument.new(*@args)
83
+ def missing_argument(*args)
84
+ args = @args if args.empty?
85
+ raise OptionParser::MissingArgument.new(*args)
82
86
  end
83
87
 
84
- def invalid_option
85
- raise OptionParser::InvalidOption.new(*@args)
88
+ def invalid_option(*args)
89
+ args = @args if args.empty?
90
+ raise OptionParser::InvalidOption.new(*args)
86
91
  end
87
92
 
88
- def invalid_argument
89
- raise OptionParser::InvalidArgument.new(*@args)
93
+ def invalid_argument(*args)
94
+ args = @args if args.empty?
95
+ raise OptionParser::InvalidArgument.new(*args)
90
96
  end
91
97
 
92
- def ambiguous_argument
93
- raise OptionParser::AmbiguousArgument.new(*@args)
98
+ def ambiguous_argument(*args)
99
+ args = @args if args.empty?
100
+ raise OptionParser::AmbiguousArgument.new(*args)
94
101
  end
95
102
 
96
- def not_given
97
- raise OptionParser::NotGiven.new(*@args)
103
+ def not_given(*args)
104
+ args = @args if args.empty?
105
+ raise OptionParser::NotGiven.new(*args)
98
106
  end
99
107
  end # CheckerContext
100
108
 
@@ -162,11 +170,11 @@ module Optopus
162
170
  end
163
171
 
164
172
  value = conv.call(value) if conv
165
-
173
+
166
174
  options[name] = value
167
175
  end
168
176
  end
169
- end
177
+ end # if @file_args
170
178
 
171
179
  @opts_args.each do |name, args, defval, block, required, multiple|
172
180
  options[name] = defval unless defval.nil?
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: optopus
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 11
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 7
10
- version: 0.1.7
9
+ - 8
10
+ version: 0.1.8
11
11
  platform: ruby
12
12
  authors:
13
13
  - winebarrel