choice 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,5 +1,5 @@
1
1
  0.1.4:
2
- - Monkeypatch to Hash for #index deprecation. Only applied on RUBY_VERSION >= "1.9"
2
+ - Monkeypatch to Hash for #index deprecation. Only applied on RUBY_VERSION < "1.9"
3
3
  - Fixed rake file for README filename change
4
4
  - Fixed a broken test that's been broken since 2009.
5
5
 
@@ -81,8 +81,13 @@ module Choice
81
81
  val = class_variable_get(variable) || ''
82
82
  class_variable_set(variable, val << string)
83
83
  end
84
- end
85
84
 
85
+ if RUBY_VERSION > "1.9"
86
+ original_method = "original_#{method}"
87
+ alias_method original_method, method
88
+ eval "def #{method}(string=nil); #{original_method}(string); end"
89
+ end
90
+ end
86
91
 
87
92
  # Parse the provided args against the defined options.
88
93
  def parse #:nodoc:
@@ -165,7 +165,7 @@ module Choice
165
165
  end
166
166
 
167
167
  # Make sure the argument is valid
168
- raise InvalidArgument unless value.to_a.all? { |v| hashes['valids'][name].include?(v) } if hashes['valids'][name]
168
+ raise InvalidArgument unless Array(value).all? { |v| hashes['valids'][name].include?(v) } if hashes['valids'][name]
169
169
 
170
170
  # Cast the argument using the method defined in the constant hash.
171
171
  value = value.send(CAST_METHODS[hashes['casts'][name]]) if hashes['casts'].include?(name)
@@ -2,7 +2,7 @@ module Choice
2
2
  module Version #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- TINY = 5
5
+ TINY = 6
6
6
  STRING = [MAJOR, MINOR, TINY] * '.'
7
7
  end
8
8
  end
@@ -9,7 +9,7 @@ class TestChoice < Test::Unit::TestCase
9
9
  def setup
10
10
  Choice.reset!
11
11
  Choice.dont_exit_on_help = true
12
- Choice.send(:class_variable_set, '@@choices', true)
12
+ Choice.send(:class_variable_set, '@@choices', {})
13
13
  end
14
14
 
15
15
  def test_choices
@@ -49,7 +49,7 @@ class TestChoice < Test::Unit::TestCase
49
49
  end
50
50
 
51
51
  def test_failed_parse
52
- assert Hash.new, Choice.parse
52
+ assert_equal nil, Choice.parse
53
53
  end
54
54
 
55
55
  HELP_STRING = ''
metadata CHANGED
@@ -1,33 +1,23 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: choice
3
- version: !ruby/object:Gem::Version
4
- hash: 17
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.6
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 1
9
- - 5
10
- version: 0.1.5
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Chris Wanstrath
14
9
  autorequire: choice
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-01-25 00:00:00 -07:00
19
- default_executable:
12
+ date: 2012-03-26 00:00:00.000000000 Z
20
13
  dependencies: []
21
-
22
- description: Choice is a simple little gem for easily defining and parsing command line options with a friendly DSL.
14
+ description: Choice is a simple little gem for easily defining and parsing command
15
+ line options with a friendly DSL.
23
16
  email: chris@ozmm.org
24
17
  executables: []
25
-
26
18
  extensions: []
27
-
28
19
  extra_rdoc_files: []
29
-
30
- files:
20
+ files:
31
21
  - README.rdoc
32
22
  - CHANGELOG
33
23
  - LICENSE
@@ -44,39 +34,28 @@ files:
44
34
  - test/test_writer.rb
45
35
  - examples/ftpd.rb
46
36
  - examples/gamble.rb
47
- has_rdoc: true
48
37
  homepage: http://choice.rubyforge.org/
49
38
  licenses: []
50
-
51
39
  post_install_message:
52
40
  rdoc_options: []
53
-
54
- require_paths:
41
+ require_paths:
55
42
  - lib
56
- required_ruby_version: !ruby/object:Gem::Requirement
43
+ required_ruby_version: !ruby/object:Gem::Requirement
57
44
  none: false
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- hash: 3
62
- segments:
63
- - 0
64
- version: "0"
65
- required_rubygems_version: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ! '>='
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ required_rubygems_version: !ruby/object:Gem::Requirement
66
50
  none: false
67
- requirements:
68
- - - ">="
69
- - !ruby/object:Gem::Version
70
- hash: 3
71
- segments:
72
- - 0
73
- version: "0"
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
74
55
  requirements: []
75
-
76
56
  rubyforge_project:
77
- rubygems_version: 1.4.2
57
+ rubygems_version: 1.8.15
78
58
  signing_key:
79
59
  specification_version: 3
80
60
  summary: Choice is a command line option parser.
81
61
  test_files: []
82
-