minimist 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e7fb0a6d33c9ccc2e3cd68322628d29bc645d22c
4
- data.tar.gz: 62cb29826e6e208ad0a1269d31cb914f37a675cd
3
+ metadata.gz: 695086ee2373642e08f682dbbf21bf85fb5928a8
4
+ data.tar.gz: 96f723308581e4eca9c20b7ddb624284456d4af9
5
5
  SHA512:
6
- metadata.gz: 8eb9b785e24a770b3c1a98f217b8e09a454e4d77ac024269a876584934842eb489656649e038a111e83861c847468f975957b9b507143e9c35929bb2e5dab02e
7
- data.tar.gz: e404dd665e0d43c0abfa6eca42665354e2ffce7ac0dfd0b28f5a3af75aac908db8c84884bb36a91070c80a7f8dcce96ecaa93cce701743bee2492d288194a1d8
6
+ metadata.gz: a8167a565b40343ada9eee7cd5544d0561885f415ba25cf75a89584db00bc60403c896de43b413ad11018f7c8cdcb626cd386c388212e1deddb0f4924c56be5a
7
+ data.tar.gz: 05e6cc33b5fbbebcf95fdefe41b1c136493c1913c52680c2e61384210a491b184e2e35370de229a3edf550605c073e44f1db73b68c003c76f45229e48c07da84
@@ -1,3 +1,4 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - 2.1.5
4
+ script: bundle exec rspec
data/Gemfile CHANGED
@@ -3,4 +3,6 @@ source 'https://rubygems.org'
3
3
  # Specify your gem's dependencies in minimist.gemspec
4
4
  gemspec
5
5
 
6
- gem 'pry'
6
+ group :development do
7
+ gem 'pry'
8
+ end
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Minimist
1
+ # Minimist ![Build Status](https://api.travis-ci.org/ConnorAtherton/minimist.svg)
2
2
 
3
3
  A tiny ruby ARGV parser.
4
4
 
@@ -73,7 +73,7 @@ module Minimist
73
73
  if match_data = arg.match(/^-([A-Za-z])([0-9])$/)
74
74
  argv_object[:options][match_data[1].to_sym] = match_data[2]
75
75
  elsif @argv[index + 1] =~ /^(\d|[A-Za-z])/
76
- argv_object[:options][arg.slice(1..-1).to_sym] = try_convert(@argv[index + 1])
76
+ argv_object[:options][arg.slice(1..-1).to_sym] = transform(@argv[index + 1])
77
77
  should_skip = true
78
78
  else
79
79
  #
@@ -94,7 +94,7 @@ module Minimist
94
94
  should_skip = false
95
95
 
96
96
  if !match_data[2].empty?
97
- argv_object[:options][match_data[1].to_sym] = try_convert(match_data[2])
97
+ argv_object[:options][match_data[1].to_sym] = match_data[2]
98
98
  else
99
99
  val = true
100
100
 
@@ -103,7 +103,7 @@ module Minimist
103
103
  should_skip = true
104
104
  end
105
105
 
106
- argv_object[:options][match_data[1].to_sym] = val
106
+ argv_object[:options][transform(match_data[1].to_sym)] = val
107
107
  end
108
108
 
109
109
  [argv_object, should_skip]
@@ -119,8 +119,8 @@ module Minimist
119
119
  [argv_object, false]
120
120
  end
121
121
 
122
- def try_convert(val)
123
- Number(val) rescue val
122
+ def transform(val)
123
+ val.to_s.gsub('-', '_').to_sym
124
124
  end
125
125
  end
126
126
  end
@@ -1,3 +1,3 @@
1
1
  module Minimist
2
- VERSION = "0.4.0"
2
+ VERSION = '0.5.0'
3
3
  end
@@ -19,6 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
20
  spec.require_paths = ["lib"]
21
21
 
22
- spec.add_development_dependency "bundler", "~> 1.8"
23
- spec.add_development_dependency "rake", "~> 10.0"
22
+ spec.add_development_dependency "bundler"
23
+ spec.add_development_dependency "rake"
24
+ spec.add_development_dependency "rspec"
24
25
  end
metadata CHANGED
@@ -1,43 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minimist
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Connor Atherton
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-05-09 00:00:00.000000000 Z
11
+ date: 2015-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.8'
19
+ version: '0'
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.8'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  description: A lightweight ruby argv parser.
42
56
  email:
43
57
  - c.liam.atherton@gmail.com