clasp-ruby 0.20.0 → 0.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/clasp/arguments.rb +11 -0
- data/lib/clasp/specifications.rb +3 -3
- data/lib/clasp/version.rb +1 -1
- data/test/unit/tc_arguments_1.rb +7 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f92b789f37af02b75b9644ff0d68c2f8dc1fb37bed7372f85a2e3076bda3318c
|
4
|
+
data.tar.gz: 915b038fa26a675ff5adef533286ed89dd1637cab521d9d187eb2cc28eb60405
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14b4ed81618a5564af21068ed04f8443cb0e699763f3489d91deae285bf3e7b2e5a8b77e0331185cec751659772ddd6d54a3a93ac1ee98aaf05f0a11c12d78b4
|
7
|
+
data.tar.gz: 90b82b5a6b1553c540f8904dbc4c2b3fe7257a0c177fbb4cacc4004af9e46470f5f0af8e119a635cf25062ab1b41a7bee54c9c4a512e74a48807b9cda4da4779
|
data/lib/clasp/arguments.rb
CHANGED
@@ -491,6 +491,17 @@ class Arguments
|
|
491
491
|
|
492
492
|
resolved_name = "#$1#$2"
|
493
493
|
value ||= $'
|
494
|
+
|
495
|
+
# now find the underlying (option) specification
|
496
|
+
specifications.each do |t|
|
497
|
+
|
498
|
+
if t.name == resolved_name or t.aliases.include? resolved_name
|
499
|
+
|
500
|
+
argument_spec = t
|
501
|
+
|
502
|
+
break
|
503
|
+
end
|
504
|
+
end
|
494
505
|
end
|
495
506
|
|
496
507
|
break
|
data/lib/clasp/specifications.rb
CHANGED
@@ -97,7 +97,7 @@ class FlagSpecification
|
|
97
97
|
case rhs
|
98
98
|
when self.class
|
99
99
|
|
100
|
-
|
100
|
+
return true if equal?(rhs)
|
101
101
|
else
|
102
102
|
|
103
103
|
return false
|
@@ -230,7 +230,7 @@ class OptionSpecification
|
|
230
230
|
case rhs
|
231
231
|
when self.class
|
232
232
|
|
233
|
-
|
233
|
+
return true if equal?(rhs)
|
234
234
|
else
|
235
235
|
|
236
236
|
return false
|
@@ -241,7 +241,7 @@ class OptionSpecification
|
|
241
241
|
return false unless help == rhs.help
|
242
242
|
return false unless values_range == rhs.values_range
|
243
243
|
return false unless default_value == rhs.default_value
|
244
|
-
return false unless required == rhs.required
|
244
|
+
return false unless required? == rhs.required?
|
245
245
|
return false unless required_message == rhs.required_message
|
246
246
|
return false unless extras == rhs.extras
|
247
247
|
|
data/lib/clasp/version.rb
CHANGED
data/test/unit/tc_arguments_1.rb
CHANGED
@@ -518,6 +518,7 @@ class Test_Arguments < Test::Unit::TestCase
|
|
518
518
|
assert_equal '-o', args.options[0].given_name
|
519
519
|
assert_equal 1, args.options[0].given_hyphens
|
520
520
|
assert_equal Hash.new, args.options[0].extras
|
521
|
+
assert_equal specifications[0], args.options[0].argument_specification
|
521
522
|
|
522
523
|
assert_equal 1, args.values.size
|
523
524
|
assert_equal 'value1', args.values[0]
|
@@ -541,6 +542,7 @@ class Test_Arguments < Test::Unit::TestCase
|
|
541
542
|
assert_equal Hash.new, args.flags[0].extras
|
542
543
|
|
543
544
|
assert_equal 3, args.options.size
|
545
|
+
assert_equal 2, args.options[0].given_index
|
544
546
|
assert_equal '--option=value', args.options[0].to_s
|
545
547
|
assert_equal '--option', args.options[0].name
|
546
548
|
assert_equal 'o', args.options[0].given_label
|
@@ -548,6 +550,8 @@ class Test_Arguments < Test::Unit::TestCase
|
|
548
550
|
assert_equal '-o', args.options[0].given_name
|
549
551
|
assert_equal 1, args.options[0].given_hyphens
|
550
552
|
assert_equal Hash.new, args.options[0].extras
|
553
|
+
assert_equal specifications[0], args.options[0].argument_specification
|
554
|
+
assert_equal 4, args.options[1].given_index
|
551
555
|
assert_equal '--option=special-value', args.options[1].to_s
|
552
556
|
assert_equal '--option', args.options[1].name
|
553
557
|
assert_equal 's', args.options[1].given_label
|
@@ -555,6 +559,8 @@ class Test_Arguments < Test::Unit::TestCase
|
|
555
559
|
assert_equal '-s', args.options[1].given_name
|
556
560
|
assert_equal 1, args.options[1].given_hyphens
|
557
561
|
assert_equal Hash.new, args.options[1].extras
|
562
|
+
assert_equal specifications[0], args.options[1].argument_specification
|
563
|
+
assert_equal 5, args.options[2].given_index
|
558
564
|
assert_equal '--option=explicit-value', args.options[2].to_s
|
559
565
|
assert_equal '--option', args.options[2].name
|
560
566
|
assert_equal 's', args.options[2].given_label
|
@@ -562,6 +568,7 @@ class Test_Arguments < Test::Unit::TestCase
|
|
562
568
|
assert_equal '-s', args.options[2].given_name
|
563
569
|
assert_equal 1, args.options[2].given_hyphens
|
564
570
|
assert_equal Hash.new, args.options[2].extras
|
571
|
+
assert_equal specifications[0], args.options[2].argument_specification
|
565
572
|
|
566
573
|
assert_equal 1, args.values.size
|
567
574
|
assert_equal 'value1', args.values[0]
|