tins 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.1
1
+ 0.4.2
@@ -24,7 +24,6 @@ module Tins
24
24
  # An option hash is returned with all found options set to true or the
25
25
  # found option argument.
26
26
  def go(s, args = ARGV)
27
- args = args.map(&:dup)
28
27
  b, v = s.scan(/(.)(:?)/).inject([ {}, {} ]) { |t, (o, a)|
29
28
  a = a == ':'
30
29
  t[a ? 1 : 0][o] = a ? nil : false
@@ -42,6 +41,7 @@ module Tins
42
41
  a = p
43
42
  end
44
43
  if v[o].nil?
44
+ a = a.dup
45
45
  a.extend EnumerableExtension
46
46
  a.push a
47
47
  v[o] = a
@@ -1,6 +1,6 @@
1
1
  module Tins
2
2
  # Tins version
3
- VERSION = '0.4.1'
3
+ VERSION = '0.4.2'
4
4
  VERSION_ARRAY = VERSION.split(/\./).map { |x| x.to_i } # :nodoc:
5
5
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
6
6
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
@@ -7,38 +7,44 @@ module Tins
7
7
 
8
8
 
9
9
  def test_empty_string
10
- r = go '', %w[a b c]
10
+ r = go '', args = %w[a b c]
11
11
  assert_equal({}, r)
12
+ assert_equal %w[a b c], args
12
13
  end
13
14
 
14
15
  def test_empty_args
15
- r = go 'ab:', []
16
+ r = go 'ab:', args = []
16
17
  assert_equal({ 'a' => false, 'b' => nil }, r)
18
+ assert_equal [], args
17
19
  end
18
20
 
19
21
  def test_simple
20
- r = go 'ab:', %w[-b hello -a -c]
22
+ r = go 'ab:', args = %w[-b hello -a -c rest]
21
23
  assert_equal({ 'a' => 1, 'b' => 'hello' }, r)
24
+ assert_equal %w[-c rest], args
22
25
  end
23
26
 
24
27
  def test_complex
25
- r = go 'ab:', %w[-a -b hello -a -bworld -c]
28
+ r = go 'ab:', args = %w[-a -b hello -a -bworld -c rest]
26
29
  assert_equal({ 'a' => 2, 'b' => 'hello' }, r)
27
30
  assert_equal %w[hello world], r['b'].to_a
31
+ assert_equal %w[-c rest], args
28
32
  end
29
33
 
30
34
  def test_complex2
31
- r = go 'ab:', %w[-b hello -aa -b world -c]
35
+ r = go 'ab:', args = %w[-b hello -aa -b world -c rest]
32
36
  assert_equal({ 'a' => 2, 'b' => 'hello' }, r)
33
37
  assert_equal %w[hello world], r['b'].to_a
38
+ assert_equal %w[-c rest], args
34
39
  end
35
40
 
36
41
  def test_complex_frozen
37
- args = %w[-b hello -aa -b world -c]
42
+ args = %w[-b hello -aa -b world -c rest]
38
43
  args = args.map(&:freeze)
39
44
  r = go 'ab:', args
40
45
  assert_equal({ 'a' => 2, 'b' => 'hello' }, r)
41
46
  assert_equal %w[hello world], r['b'].to_a
47
+ assert_equal %w[-c rest], args
42
48
  end
43
49
  end
44
50
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "tins"
5
- s.version = "0.4.1"
5
+ s.version = "0.4.2"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Florian Frank"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tins
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -351,7 +351,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
351
351
  version: '0'
352
352
  segments:
353
353
  - 0
354
- hash: 4100283347471528269
354
+ hash: 543401061264393695
355
355
  required_rubygems_version: !ruby/object:Gem::Requirement
356
356
  none: false
357
357
  requirements: