samovar 1.8.0 → 1.9.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 3cafa27a96a1dafef5c1ff0cca78482762cb0b5d
4
- data.tar.gz: 8c0542e476d2d1c084853b2cbba653e180f9af70
2
+ SHA256:
3
+ metadata.gz: b84967921a214bcd65328f937feca4b427c09fb07d29502726a4f1f336c4bca1
4
+ data.tar.gz: c744a006f8edf7923f7dac144677bb7ccad71ef766956ea8e8ab97caa408193a
5
5
  SHA512:
6
- metadata.gz: 295be26bc9e45c82619dffb562100ec689f5c6ecbaaad0fd2ba0484749be1847962783ccb68a9b4a3466c03f905ca133a2199f255657d512e9e59c7fde74eba3
7
- data.tar.gz: 1259e9a4fb09a873b43e79896627fd7d34b84e5ad3c83d20bc3e038bdcd5a5d93ca953ade5374a58f28f6c56725c491decf8ca3d224a0d14ea0eb843970c1150
6
+ metadata.gz: 1f9d6a2dee6f8c9a7191fed4d51c3fef99202c3f75656014e9c076ee7e9f6d5520041329d02d3794b5abece10c9cab4834d70004706f7f7c54b72b8718e3a314
7
+ data.tar.gz: 45622ffd8225f5e09d7e041ebf904c307f61990ca88ab4239d1d6c499f8eb8774f6b58811896e807aba9a036948b522b353dbb5cc27164217f76e2bf0f035021
@@ -55,6 +55,8 @@ module Samovar
55
55
  Integer(result)
56
56
  elsif @type == Float
57
57
  Float(result)
58
+ elsif @type == Symbol
59
+ result.to_sym
58
60
  elsif @type.respond_to? :call
59
61
  @type.call(result)
60
62
  elsif @type.respond_to? :new
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module Samovar
22
- VERSION = "1.8.0"
22
+ VERSION = "1.9.0"
23
23
  end
@@ -7,9 +7,16 @@ module Samovar::NestedSpec
7
7
  end
8
8
 
9
9
  class InnerB < Samovar::Command
10
+ options do
11
+ option '--help'
12
+ end
10
13
  end
11
14
 
12
15
  class Outer < Samovar::Command
16
+ options do
17
+ option '--help'
18
+ end
19
+
13
20
  nested '<command>',
14
21
  'inner-a' => InnerA,
15
22
  'inner-b' => InnerB,
@@ -26,5 +33,10 @@ module Samovar::NestedSpec
26
33
  outer = Outer['inner-a']
27
34
  expect(outer.command).to be_kind_of(InnerA)
28
35
  end
36
+
37
+ xit "should parse help option at outer level" do
38
+ outer = Outer['inner-a', '--help']
39
+ expect(outer.options[:help]).to_be truthy
40
+ end
29
41
  end
30
42
  end
@@ -4,6 +4,8 @@ RSpec.describe Samovar::Options do
4
4
  described_class.parse do
5
5
  option '-x <value>', "The x factor", default: 2
6
6
  option '-y <value>', "The y factor"
7
+
8
+ option '--symbol <value>', "A symbol", type: Symbol
7
9
  end
8
10
  end
9
11
 
@@ -21,4 +23,9 @@ RSpec.describe Samovar::Options do
21
23
  values = options.parse(['-x', 10], {x: 1, y: 2, z: 3})
22
24
  expect(values).to be == {x: 10, y: 2, z: 3}
23
25
  end
26
+
27
+ it "converts to symbol" do
28
+ values = options.parse(['--symbol', 'thing'], {})
29
+ expect(values[:symbol]).to eq :thing
30
+ end
24
31
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: samovar
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.0
4
+ version: 1.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-10 00:00:00.000000000 Z
11
+ date: 2018-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mapping
@@ -135,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
135
135
  version: '0'
136
136
  requirements: []
137
137
  rubyforge_project:
138
- rubygems_version: 2.6.12
138
+ rubygems_version: 2.7.6
139
139
  signing_key:
140
140
  specification_version: 4
141
141
  summary: Samovar is a flexible option parser excellent support for sub-commands and