docopt 0.6.0 → 0.6.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/docopt.gemspec +2 -2
- data/lib/docopt.rb +9 -9
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8589d04bd97d7ca70e1b367da7403234561b2d7
|
4
|
+
data.tar.gz: e5d3886b8e7efa11211bc97b7e28c317a7420124
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2558e4c8c89e521c2906ef18f1822b6aedad416d4379d4b879ad229f4d54d7f33b3d01c332f62e4f47a7817905988e8d127d1aa79ac8cbb030d0744fe1336ab
|
7
|
+
data.tar.gz: 8cc6419bfa468d6ea078d0a55f821713313dd23f82369d78a63ba6e100929974531239de64c836937e1575151edde2ec8c08c4494485dd6493aeb8abf393e43a
|
data/docopt.gemspec
CHANGED
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
|
|
13
13
|
## If your rubyforge_project name is different, then edit it and comment out
|
14
14
|
## the sub! line in the Rakefile
|
15
15
|
s.name = 'docopt'
|
16
|
-
s.version = '0.6.
|
17
|
-
s.date = '
|
16
|
+
s.version = '0.6.1'
|
17
|
+
s.date = '2018-01-21'
|
18
18
|
# s.rubyforge_project = 'docopt'
|
19
19
|
|
20
20
|
## Make sure your summary is short. The description may be as long
|
data/lib/docopt.rb
CHANGED
@@ -86,31 +86,31 @@ module Docopt
|
|
86
86
|
groups = [[self]]
|
87
87
|
while groups.count > 0
|
88
88
|
children = groups.shift
|
89
|
-
types = children.map { |
|
89
|
+
types = children.map { |child| child.class }
|
90
90
|
|
91
91
|
if types.include?(Either)
|
92
|
-
either = children.select { |
|
92
|
+
either = children.select { |child| child.class == Either }[0]
|
93
93
|
children.slice!(children.index(either))
|
94
94
|
for c in either.children
|
95
95
|
groups << [c] + children
|
96
96
|
end
|
97
97
|
elsif types.include?(Required)
|
98
|
-
required = children.select { |
|
98
|
+
required = children.select { |child| child.class == Required }[0]
|
99
99
|
children.slice!(children.index(required))
|
100
100
|
groups << required.children + children
|
101
101
|
|
102
102
|
elsif types.include?(Optional)
|
103
|
-
optional = children.select { |
|
103
|
+
optional = children.select { |child| child.class == Optional }[0]
|
104
104
|
children.slice!(children.index(optional))
|
105
105
|
groups << optional.children + children
|
106
106
|
|
107
107
|
elsif types.include?(AnyOptions)
|
108
|
-
anyoptions = children.select { |
|
108
|
+
anyoptions = children.select { |child| child.class == AnyOptions }[0]
|
109
109
|
children.slice!(children.index(anyoptions))
|
110
110
|
groups << anyoptions.children + children
|
111
111
|
|
112
112
|
elsif types.include?(OneOrMore)
|
113
|
-
oneormore = children.select { |
|
113
|
+
oneormore = children.select { |child| child.class == OneOrMore }[0]
|
114
114
|
children.slice!(children.index(oneormore))
|
115
115
|
groups << (oneormore.children * 2) + children
|
116
116
|
|
@@ -314,7 +314,7 @@ module Docopt
|
|
314
314
|
def match(left, collected=nil)
|
315
315
|
collected ||= []
|
316
316
|
for p in self.children
|
317
|
-
|
317
|
+
_, left, collected = p.match(left, collected)
|
318
318
|
end
|
319
319
|
return [true, left, collected]
|
320
320
|
end
|
@@ -356,9 +356,9 @@ module Docopt
|
|
356
356
|
collected ||= []
|
357
357
|
outcomes = []
|
358
358
|
for p in self.children
|
359
|
-
matched, _, _ =
|
359
|
+
matched, _, _ = found = p.match(left, collected)
|
360
360
|
if matched
|
361
|
-
outcomes <<
|
361
|
+
outcomes << found
|
362
362
|
end
|
363
363
|
end
|
364
364
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: docopt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Blake Williams
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2018-01-21 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: json
|