optsparser_generator 1.0 → 1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/optsparser_generator.rb +7 -8
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dcbe1e73825ba5ba097c4bd260424f2eaf0fe286
|
4
|
+
data.tar.gz: b8595c9abc7ad0f13fa0c41c04f0845308a0262d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 08e11abeebc8b5ffd471488fee1ea592b52b3f11552f36b398d1f45b0e59127751d1dd3be74bc611baab2c755e39537616dc501dcecfd48aaad1c3646e003669
|
7
|
+
data.tar.gz: 14871d9b25637519b5e629ee8268cf52dc58994e336c1e5104a5a9a0747cceb2064ae16553daafcb34473ac605b073f63816e7c0d7ec9be5498d234d9192f856
|
data/lib/optsparser_generator.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'ostruct'
|
2
2
|
require 'optparse'
|
3
|
-
require 'pp'
|
4
3
|
|
5
4
|
class OptParseGenerator
|
6
5
|
def initialize(ostruct)
|
@@ -58,16 +57,13 @@ class OptParseGenerator
|
|
58
57
|
end
|
59
58
|
end
|
60
59
|
|
61
|
-
def
|
62
|
-
|
63
|
-
respond_to?(method_sym, include_private)
|
64
|
-
else
|
65
|
-
@optparser.respond_to?(method_sym, include_private)
|
66
|
-
end
|
60
|
+
def respond_to?(method_sym, include_private = false)
|
61
|
+
@optparser.respond_to?(method_sym, include_private) || super
|
67
62
|
end
|
68
63
|
end
|
69
64
|
|
70
65
|
# tests
|
66
|
+
# require 'optsparser_generator'
|
71
67
|
# options = OpenStruct.new
|
72
68
|
# options.no_filter = false
|
73
69
|
# options.no_filter__help = 'bla bla helP!'
|
@@ -80,7 +76,10 @@ end
|
|
80
76
|
# options.fix_method_names_with_known_ones = true
|
81
77
|
|
82
78
|
# optparser = OptParseGenerator.new(options)
|
79
|
+
# raise 'broken' unless optparser.respond_to? :to_s
|
80
|
+
# raise 'broken' if optparser.respond_to? :notthere
|
81
|
+
|
83
82
|
# puts optparser.parse!(['--no-filter']).inspect
|
84
83
|
# puts optparser.parse!(['--log=other/path']).inspect
|
85
84
|
# optparser.parse!(['--help'])
|
86
|
-
#
|
85
|
+
# raise 'Error: --help did not quit'
|