slop 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +2 -2
- data/lib/slop.rb +3 -3
- data/spec/slop_spec.rb +7 -1
- metadata +3 -3
data/README.md
CHANGED
@@ -33,7 +33,7 @@ Usage
|
|
33
33
|
|
34
34
|
# shortcut option aliases
|
35
35
|
opt(:height, "Your height")
|
36
|
-
o(:weight, "Your weight)
|
36
|
+
o(:weight, "Your weight")
|
37
37
|
end
|
38
38
|
|
39
39
|
# using `--name Lee -a 100`
|
@@ -116,4 +116,4 @@ Contributing
|
|
116
116
|
|
117
117
|
If you'd like to contribute to Slop (it's **really** appreciated) please fork
|
118
118
|
the GitHub repository, create your feature/bugfix branch, add specs, and send
|
119
|
-
me a pull request. I'd be more than happy to look at it.
|
119
|
+
me a pull request. I'd be more than happy to look at it.
|
data/lib/slop.rb
CHANGED
@@ -3,7 +3,7 @@ require 'set'
|
|
3
3
|
require 'slop/option'
|
4
4
|
|
5
5
|
class Slop
|
6
|
-
VERSION = '0.1.
|
6
|
+
VERSION = '0.1.6'
|
7
7
|
|
8
8
|
# Raised when an option expects an argument and none is given
|
9
9
|
class MissingArgumentError < ArgumentError; end
|
@@ -106,7 +106,7 @@ class Slop
|
|
106
106
|
# @return [Hash]
|
107
107
|
def options_hash
|
108
108
|
out = {}
|
109
|
-
|
109
|
+
options.each do |opt|
|
110
110
|
if opt.requires_argument? or opt.has_default?
|
111
111
|
out[opt.key] = opt.argument_value || opt.default
|
112
112
|
end
|
@@ -155,4 +155,4 @@ class Slop
|
|
155
155
|
return unless flag
|
156
156
|
flag[1, 2].include?('-')
|
157
157
|
end
|
158
|
-
end
|
158
|
+
end
|
data/spec/slop_spec.rb
CHANGED
@@ -44,6 +44,12 @@ describe Slop do
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
+
describe "options_hash" do
|
48
|
+
it "returns a hash" do
|
49
|
+
@slop.options_hash.should be_kind_of(Hash)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
47
53
|
describe "option_for" do
|
48
54
|
it "returns an option" do
|
49
55
|
@slop.option_for(:v).should be_kind_of(Slop::Option)
|
@@ -110,4 +116,4 @@ describe Slop do
|
|
110
116
|
end
|
111
117
|
end
|
112
118
|
|
113
|
-
end
|
119
|
+
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 6
|
9
|
+
version: 0.1.6
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Lee Jarvis
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-12-
|
17
|
+
date: 2010-12-04 00:00:00 +00:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|