clamp 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/clamp/parameter/parsing.rb +1 -1
- data/lib/clamp/version.rb +1 -1
- data/spec/clamp/command_spec.rb +6 -6
- metadata +4 -4
@@ -10,7 +10,7 @@ module Clamp
|
|
10
10
|
self.class.parameters.each do |parameter|
|
11
11
|
begin
|
12
12
|
value = parameter.consume(remaining_arguments)
|
13
|
-
send("#{parameter.attribute_name}=", value)
|
13
|
+
send("#{parameter.attribute_name}=", value) unless value.nil?
|
14
14
|
rescue ArgumentError => e
|
15
15
|
signal_usage_error "parameter '#{parameter.name}': #{e.message}"
|
16
16
|
end
|
data/lib/clamp/version.rb
CHANGED
data/spec/clamp/command_spec.rb
CHANGED
@@ -317,17 +317,17 @@ describe Clamp::Command do
|
|
317
317
|
describe "with :default value" do
|
318
318
|
|
319
319
|
before do
|
320
|
-
@command.class.parameter "[
|
320
|
+
@command.class.parameter "[ORIENTATION]", "direction", :default => "west"
|
321
321
|
end
|
322
322
|
|
323
323
|
it "sets the specified default value" do
|
324
|
-
@command.
|
324
|
+
@command.orientation.should == "west"
|
325
325
|
end
|
326
326
|
|
327
327
|
describe "#help" do
|
328
328
|
|
329
329
|
it "describes the default value" do
|
330
|
-
@command.help.should include("
|
330
|
+
@command.help.should include("direction (default: \"west\")")
|
331
331
|
end
|
332
332
|
|
333
333
|
end
|
@@ -377,7 +377,7 @@ describe Clamp::Command do
|
|
377
377
|
before do
|
378
378
|
@command.class.parameter "X", "x"
|
379
379
|
@command.class.parameter "Y", "y"
|
380
|
-
@command.class.parameter "[Z]", "z"
|
380
|
+
@command.class.parameter "[Z]", "z", :default => "ZZZ"
|
381
381
|
end
|
382
382
|
|
383
383
|
describe "#parse" do
|
@@ -408,11 +408,11 @@ describe Clamp::Command do
|
|
408
408
|
|
409
409
|
describe "with optional argument omitted" do
|
410
410
|
|
411
|
-
it "defaults the optional argument
|
411
|
+
it "defaults the optional argument" do
|
412
412
|
@command.parse(["crash", "bang"])
|
413
413
|
@command.x.should == "crash"
|
414
414
|
@command.y.should == "bang"
|
415
|
-
@command.z.should ==
|
415
|
+
@command.z.should == "ZZZ"
|
416
416
|
end
|
417
417
|
|
418
418
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clamp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 11
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 8
|
10
|
+
version: 0.1.8
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Mike Williams
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-01-
|
18
|
+
date: 2011-01-31 00:00:00 +11:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|