tins 1.9.0 → 1.10.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
2
  SHA1:
3
- metadata.gz: e47e2a7320e764d140a7f3a96366c6d4317e8c3e
4
- data.tar.gz: 439500131858c99b5b650bef1e3a0d7800a9d38b
3
+ metadata.gz: 8d95f5373263dfc49acdc7454b95d6478380b9c8
4
+ data.tar.gz: 373d5f71db24e78f3cc2a06cfb1bd118b1399e42
5
5
  SHA512:
6
- metadata.gz: 06f40d2c367606b173325cdc1fedae2870781fc42a1a9ac8694f71c0217fed8ec0849b0167975cfed5f5a402cbc3aa40e685f4d23fd6788b88d21ed85e92ac75
7
- data.tar.gz: a70916db92071ea8263548e558543b1451aa03289738a0b49fadb6662f7287312d96481a4f6e66c27dc06a938c1615628ec5b3643dd150be8140a6011eee7977
6
+ metadata.gz: d05d1f070f99951cc7a4307210804f5c72b7fc9209d4540c3604c87bdc076e3d2074ccd6c2ac0ee58034c8af05ed884ed918244dc8916231445365cca8c1e6d0
7
+ data.tar.gz: cc037cae1e42b6c8831fc785b95d371f2f68d2ed4b1686a09f7b6cdd4248ef5681f898d6889e0a6516db5132540dcd7a0b6eb1d6ed84ecf8f71bf69cf7051f4e
@@ -2,6 +2,7 @@ rvm:
2
2
  - 2.0
3
3
  - 2.1
4
4
  - 2.2
5
+ - 2.3.0
5
6
  - ruby-head
6
7
  - rbx-head
7
8
  - jruby-head
data/README.md CHANGED
@@ -12,7 +12,10 @@ Non yet.
12
12
 
13
13
  ## Changes
14
14
 
15
-
15
+ * 2016-04-12 Release 1.10.0
16
+ - Support mixed rest arguments in go argument parsing.
17
+ * 2016-03-10 Release 1.9.0
18
+ - Add Tins::Duration for displaying durations.
16
19
  * 2016-01-18 Release 1.8.2
17
20
  - Implement Tins::StringVersion::Version#dup and
18
21
  Tins::StringVersion::Version#clone.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.9.0
1
+ 1.10.0
@@ -6,6 +6,7 @@ module Tins
6
6
  @arguments.push argument
7
7
  self
8
8
  end
9
+ alias << push
9
10
 
10
11
  def each(&block)
11
12
  @arguments.each(&block)
@@ -29,38 +30,41 @@ module Tins
29
30
  t[a ? 1 : 0][o] = a ? nil : false
30
31
  t
31
32
  }
33
+ r = []
32
34
  while a = args.shift
33
- a !~ /\A-(.+)/ and args.unshift a and break
34
- p = $1
35
+ /\A-(?<p>.+)/ =~ a or (r << a; next)
35
36
  until p == ''
36
37
  o = p.slice!(0, 1)
37
38
  if v.key?(o)
38
- if p == '' then
39
- a = args.shift or break 1
39
+ if args.empty?
40
+ r << a
41
+ break 1
42
+ elsif p == ''
43
+ a = args.shift
40
44
  else
41
45
  a = p
42
46
  end
43
47
  if v[o].nil?
44
48
  a = a.dup
45
49
  a.extend EnumerableExtension
46
- a.push a
50
+ a << a
47
51
  v[o] = a
48
52
  else
49
- v[o].push a
53
+ v[o] << a
50
54
  end
51
55
  break
52
56
  elsif b.key?(o)
53
- if b[o] == false
54
- b[o]= 1
55
- else
57
+ if b[o]
56
58
  b[o] += 1
59
+ else
60
+ b[o] = 1
57
61
  end
58
62
  else
59
- args.unshift a
60
- break 1
63
+ r << a
61
64
  end
62
- end and break
65
+ end && break
63
66
  end
67
+ args.replace r
64
68
  b.merge(v)
65
69
  end
66
70
  end
@@ -1,6 +1,6 @@
1
1
  module Tins
2
2
  # Tins version
3
- VERSION = '1.9.0'
3
+ VERSION = '1.10.0'
4
4
  VERSION_ARRAY = VERSION.split('.').map(&:to_i) # :nodoc:
5
5
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
6
6
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
@@ -5,7 +5,6 @@ module Tins
5
5
  class GoTest < Test::Unit::TestCase
6
6
  include Tins::GO
7
7
 
8
-
9
8
  def test_empty_string
10
9
  r = go '', args = %w[a b c]
11
10
  assert_equal({}, r)
@@ -46,5 +45,12 @@ module Tins
46
45
  assert_equal %w[hello world], r['b'].to_a
47
46
  assert_equal %w[-c rest], args
48
47
  end
48
+
49
+ def test_mixed_rest
50
+ r = go 'ab:e:', args = %w[-b hello -c rest -aa -b world -d rest -e]
51
+ assert_equal({ 'a' => 2, 'b' => 'hello', 'e' => nil }, r)
52
+ assert_equal %w[hello world], r['b'].to_a
53
+ assert_equal %w[-c rest -d rest -e], args
54
+ end
49
55
  end
50
56
  end
@@ -1,14 +1,14 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: tins 1.9.0 ruby lib
2
+ # stub: tins 1.10.0 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "tins"
6
- s.version = "1.9.0"
6
+ s.version = "1.10.0"
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
9
9
  s.require_paths = ["lib"]
10
10
  s.authors = ["Florian Frank"]
11
- s.date = "2016-03-10"
11
+ s.date = "2016-04-12"
12
12
  s.description = "All the stuff that isn't good/big enough for a real library."
13
13
  s.email = "flori@ping.de"
14
14
  s.extra_rdoc_files = ["README.md", "lib/dslkit.rb", "lib/dslkit/polite.rb", "lib/dslkit/rude.rb", "lib/spruz.rb", "lib/tins.rb", "lib/tins/alias.rb", "lib/tins/annotate.rb", "lib/tins/ask_and_send.rb", "lib/tins/attempt.rb", "lib/tins/bijection.rb", "lib/tins/case_predicate.rb", "lib/tins/complete.rb", "lib/tins/concern.rb", "lib/tins/count_by.rb", "lib/tins/date_dummy.rb", "lib/tins/date_time_dummy.rb", "lib/tins/deep_const_get.rb", "lib/tins/deep_dup.rb", "lib/tins/dslkit.rb", "lib/tins/duration.rb", "lib/tins/extract_last_argument_options.rb", "lib/tins/file_binary.rb", "lib/tins/find.rb", "lib/tins/generator.rb", "lib/tins/go.rb", "lib/tins/hash_symbolize_keys_recursive.rb", "lib/tins/hash_union.rb", "lib/tins/if_predicate.rb", "lib/tins/implement.rb", "lib/tins/limited.rb", "lib/tins/lines_file.rb", "lib/tins/memoize.rb", "lib/tins/method_description.rb", "lib/tins/minimize.rb", "lib/tins/module_group.rb", "lib/tins/named_set.rb", "lib/tins/null.rb", "lib/tins/once.rb", "lib/tins/p.rb", "lib/tins/partial_application.rb", "lib/tins/proc_compose.rb", "lib/tins/proc_prelude.rb", "lib/tins/range_plus.rb", "lib/tins/require_maybe.rb", "lib/tins/responding.rb", "lib/tins/secure_write.rb", "lib/tins/sexy_singleton.rb", "lib/tins/string_byte_order_mark.rb", "lib/tins/string_camelize.rb", "lib/tins/string_underscore.rb", "lib/tins/string_version.rb", "lib/tins/subhash.rb", "lib/tins/terminal.rb", "lib/tins/thread_local.rb", "lib/tins/time_dummy.rb", "lib/tins/to.rb", "lib/tins/to_proc.rb", "lib/tins/token.rb", "lib/tins/uniq_by.rb", "lib/tins/version.rb", "lib/tins/write.rb", "lib/tins/xt.rb", "lib/tins/xt/annotate.rb", "lib/tins/xt/ask_and_send.rb", "lib/tins/xt/attempt.rb", "lib/tins/xt/blank.rb", "lib/tins/xt/case_predicate.rb", "lib/tins/xt/complete.rb", "lib/tins/xt/concern.rb", "lib/tins/xt/count_by.rb", "lib/tins/xt/date_dummy.rb", "lib/tins/xt/date_time_dummy.rb", "lib/tins/xt/deep_const_get.rb", "lib/tins/xt/deep_dup.rb", "lib/tins/xt/dslkit.rb", "lib/tins/xt/extract_last_argument_options.rb", "lib/tins/xt/file_binary.rb", "lib/tins/xt/full.rb", "lib/tins/xt/hash_symbolize_keys_recursive.rb", "lib/tins/xt/hash_union.rb", "lib/tins/xt/if_predicate.rb", "lib/tins/xt/implement.rb", "lib/tins/xt/irb.rb", "lib/tins/xt/method_description.rb", "lib/tins/xt/named.rb", "lib/tins/xt/null.rb", "lib/tins/xt/p.rb", "lib/tins/xt/partial_application.rb", "lib/tins/xt/proc_compose.rb", "lib/tins/xt/proc_prelude.rb", "lib/tins/xt/range_plus.rb", "lib/tins/xt/require_maybe.rb", "lib/tins/xt/responding.rb", "lib/tins/xt/secure_write.rb", "lib/tins/xt/sexy_singleton.rb", "lib/tins/xt/string.rb", "lib/tins/xt/string_byte_order_mark.rb", "lib/tins/xt/string_camelize.rb", "lib/tins/xt/string_underscore.rb", "lib/tins/xt/string_version.rb", "lib/tins/xt/subhash.rb", "lib/tins/xt/time_dummy.rb", "lib/tins/xt/time_freezer.rb", "lib/tins/xt/to.rb", "lib/tins/xt/uniq_by.rb", "lib/tins/xt/write.rb"]
@@ -25,14 +25,14 @@ Gem::Specification.new do |s|
25
25
  s.specification_version = 4
26
26
 
27
27
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
28
- s.add_development_dependency(%q<gem_hadar>, ["~> 1.3.1"])
28
+ s.add_development_dependency(%q<gem_hadar>, ["~> 1.7.1"])
29
29
  s.add_development_dependency(%q<test-unit>, ["~> 3.1"])
30
30
  else
31
- s.add_dependency(%q<gem_hadar>, ["~> 1.3.1"])
31
+ s.add_dependency(%q<gem_hadar>, ["~> 1.7.1"])
32
32
  s.add_dependency(%q<test-unit>, ["~> 3.1"])
33
33
  end
34
34
  else
35
- s.add_dependency(%q<gem_hadar>, ["~> 1.3.1"])
35
+ s.add_dependency(%q<gem_hadar>, ["~> 1.7.1"])
36
36
  s.add_dependency(%q<test-unit>, ["~> 3.1"])
37
37
  end
38
38
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tins
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.0
4
+ version: 1.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-10 00:00:00.000000000 Z
11
+ date: 2016-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gem_hadar
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.3.1
19
+ version: 1.7.1
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.3.1
26
+ version: 1.7.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: test-unit
29
29
  requirement: !ruby/object:Gem::Requirement