args_parser 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ === 0.0.10 2012-09-27
2
+
3
+ * bugfix default filter casting Integer/Float
4
+
1
5
  === 0.0.9 2012-09-27
2
6
 
3
7
  * github-pages URL in README
data/lib/args_parser.rb CHANGED
@@ -10,5 +10,5 @@ require 'args_parser/validator'
10
10
  require 'args_parser/config'
11
11
 
12
12
  module ArgsParser
13
- VERSION = '0.0.9'
13
+ VERSION = '0.0.10'
14
14
  end
@@ -37,10 +37,10 @@ module ArgsParser
37
37
  @validator = Validator.new
38
38
 
39
39
  filter do |v|
40
- (v.kind_of? String and v =~ /^\d+$/) ? v.to_i : v
40
+ (v.kind_of? String and v =~ /^-?\d+$/) ? v.to_i : v
41
41
  end
42
42
  filter do |v|
43
- (v.kind_of? String and v =~ /^\d+\.\d+$/) ? v.to_f : v
43
+ (v.kind_of? String and v =~ /^-?\d+\.\d+$/) ? v.to_f : v
44
44
  end
45
45
  on_filter_error do |err, name, value|
46
46
  raise err
@@ -2,7 +2,7 @@ require File.dirname(__FILE__) + '/test_helper.rb'
2
2
 
3
3
  class TestArgsParserStyleEqual < Test::Unit::TestCase
4
4
  def setup
5
- @argv = 'test --input=http://shokai.org --a --o=./out -h --depth=030 foo bar --pi=3.14 --n=ShoKaI'.split(/\s+/)
5
+ @argv = 'test --input=http://shokai.org --a --o=./out -h --depth=-030 foo bar --pi=-3.140 --n=ShoKaI'.split(/\s+/)
6
6
  @parser = ArgsParser.parse @argv, :style => :equal do
7
7
  arg :input, 'input', :alias => :i
8
8
  arg :output, 'output dir', :alias => :o
@@ -36,12 +36,12 @@ class TestArgsParserStyleEqual < Test::Unit::TestCase
36
36
  end
37
37
 
38
38
  def test_cast_integer
39
- assert @parser[:depth] == 30
39
+ assert @parser[:depth] == -30
40
40
  assert @parser[:depth].class == Fixnum
41
41
  end
42
42
 
43
43
  def test_cast_float
44
- assert @parser[:pi] == 3.14
44
+ assert @parser[:pi] == -3.14
45
45
  assert @parser[:pi].class == Float
46
46
  end
47
47
 
metadata CHANGED
@@ -1,118 +1,131 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: args_parser
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.10
4
5
  prerelease:
5
- version: 0.0.9
6
6
  platform: ruby
7
- authors:
8
- - Sho Hashimoto
7
+ authors:
8
+ - Sho Hashimoto
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2012-09-27 00:00:00 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: rdoc
17
- prerelease: false
18
- requirement: &id001 !ruby/object:Gem::Requirement
19
- none: false
20
- requirements:
21
- - - ~>
22
- - !ruby/object:Gem::Version
23
- version: "3.10"
24
- type: :development
25
- version_requirements: *id001
26
- - !ruby/object:Gem::Dependency
27
- name: newgem
28
- prerelease: false
29
- requirement: &id002 !ruby/object:Gem::Requirement
30
- none: false
31
- requirements:
32
- - - ">="
33
- - !ruby/object:Gem::Version
34
- version: 1.5.3
35
- type: :development
36
- version_requirements: *id002
37
- - !ruby/object:Gem::Dependency
38
- name: hoe
39
- prerelease: false
40
- requirement: &id003 !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ~>
44
- - !ruby/object:Gem::Version
45
- version: "3.1"
46
- type: :development
47
- version_requirements: *id003
12
+ date: 2012-09-27 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rdoc
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '3.10'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '3.10'
30
+ - !ruby/object:Gem::Dependency
31
+ name: newgem
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: 1.5.3
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: 1.5.3
46
+ - !ruby/object:Gem::Dependency
47
+ name: hoe
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: '3.1'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '3.1'
48
62
  description: Parse ARGV from command line with DSL.
49
- email:
50
- - hashimoto@shokai.org
63
+ email:
64
+ - hashimoto@shokai.org
51
65
  executables: []
52
-
53
66
  extensions: []
54
-
55
- extra_rdoc_files:
56
- - History.txt
57
- - Manifest.txt
58
- - README.rdoc
59
- files:
60
- - Gemfile
61
- - Gemfile.lock
62
- - History.txt
63
- - Manifest.txt
64
- - README.rdoc
65
- - Rakefile
66
- - lib/args_parser.rb
67
- - lib/args_parser/config.rb
68
- - lib/args_parser/error.rb
69
- - lib/args_parser/filter.rb
70
- - lib/args_parser/parser.rb
71
- - lib/args_parser/styles/default.rb
72
- - lib/args_parser/styles/equal.rb
73
- - lib/args_parser/validator.rb
74
- - samples/download_webpage.rb
75
- - samples/twitter_timeline.rb
76
- - script/console
77
- - script/destroy
78
- - script/generate
79
- - test/test_args_parser.rb
80
- - test/test_args_parser_style_equal.rb
81
- - test/test_filter.rb
82
- - test/test_helper.rb
83
- - test/test_validator.rb
84
- - .gemtest
67
+ extra_rdoc_files:
68
+ - History.txt
69
+ - Manifest.txt
70
+ - README.rdoc
71
+ files:
72
+ - Gemfile
73
+ - Gemfile.lock
74
+ - History.txt
75
+ - Manifest.txt
76
+ - README.rdoc
77
+ - Rakefile
78
+ - lib/args_parser.rb
79
+ - lib/args_parser/config.rb
80
+ - lib/args_parser/error.rb
81
+ - lib/args_parser/filter.rb
82
+ - lib/args_parser/parser.rb
83
+ - lib/args_parser/styles/default.rb
84
+ - lib/args_parser/styles/equal.rb
85
+ - lib/args_parser/validator.rb
86
+ - samples/download_webpage.rb
87
+ - samples/twitter_timeline.rb
88
+ - script/console
89
+ - script/destroy
90
+ - script/generate
91
+ - test/test_args_parser.rb
92
+ - test/test_args_parser_style_equal.rb
93
+ - test/test_filter.rb
94
+ - test/test_helper.rb
95
+ - test/test_validator.rb
96
+ - .gemtest
85
97
  homepage: http://shokai.github.com/args_parser
86
98
  licenses: []
87
-
88
99
  post_install_message:
89
- rdoc_options:
90
- - --main
91
- - README.rdoc
92
- require_paths:
93
- - lib
94
- required_ruby_version: !ruby/object:Gem::Requirement
100
+ rdoc_options:
101
+ - --main
102
+ - README.rdoc
103
+ require_paths:
104
+ - lib
105
+ required_ruby_version: !ruby/object:Gem::Requirement
95
106
  none: false
96
- requirements:
97
- - - ">="
98
- - !ruby/object:Gem::Version
99
- version: "0"
100
- required_rubygems_version: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ! '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ segments:
112
+ - 0
113
+ hash: 3130304465783938517
114
+ required_rubygems_version: !ruby/object:Gem::Requirement
101
115
  none: false
102
- requirements:
103
- - - ">="
104
- - !ruby/object:Gem::Version
105
- version: "0"
116
+ requirements:
117
+ - - ! '>='
118
+ - !ruby/object:Gem::Version
119
+ version: '0'
106
120
  requirements: []
107
-
108
121
  rubyforge_project: args_parser
109
- rubygems_version: 1.8.15
122
+ rubygems_version: 1.8.24
110
123
  signing_key:
111
124
  specification_version: 3
112
125
  summary: Parse ARGV from command line with DSL.
113
- test_files:
114
- - test/test_args_parser.rb
115
- - test/test_args_parser_style_equal.rb
116
- - test/test_filter.rb
117
- - test/test_helper.rb
118
- - test/test_validator.rb
126
+ test_files:
127
+ - test/test_args_parser.rb
128
+ - test/test_args_parser_style_equal.rb
129
+ - test/test_filter.rb
130
+ - test/test_helper.rb
131
+ - test/test_validator.rb