safe_yaml 0.9.2 → 0.9.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NzIwZmQ5ODg1ODZjY2Q1YzMyNGFlNjE1N2QyZjczNDExMWQyZGNlNg==
5
+ data.tar.gz: !binary |-
6
+ OGU2MzA2YTgzZDVkYTY2NGM3NjMyNGQ3ZTUwOTFjN2M0ODMxYzdjMg==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ NDAzMDU0MWU3OTRhMjdmYzIzMmI1OWM4YzNiYTU5OGFkNDlkNDA4OGI3ZWIx
10
+ NDU4OWRlNmMxMDM0NWE3YjMxYmQxYjczMTZhNDNlYjZlZTRiZDRiZTg0NWQz
11
+ MmFiMzA1YjRkODY0NDIwOTAyYTQ1NjE0OTc5NjEwMjFmMDlkYzI=
12
+ data.tar.gz: !binary |-
13
+ NmEzYWQ5MjA1ZTNlZTAyOTdlYWFjYTU0NzNkZDJjMWEyZTgxODJlZTg1ZWQ3
14
+ MjY4YTAwYzU4ZTI0ZjJkNzZlZmQ4ZWM2ZGViYzI1MDRiZTI5Y2EyZDI2NDAx
15
+ ZGNjYjViNjkyYmMyNzgxZTc5ZDA4MzNmODVkODA4NGFlNzJkZGI=
@@ -2,10 +2,10 @@ module SafeYAML
2
2
  class Transform
3
3
  class ToInteger
4
4
  MATCHERS = Deep.freeze([
5
- /\A[-+]?[1-9][0-9_,]*\Z/, # decimal
6
- /\A0[0-7]+\Z/, # octal
7
- /\A0x[0-9a-f]+\Z/i, # hexadecimal
8
- /\A0b[01_]+\Z/ # binary
5
+ /\A[-+]?(0|([1-9][0-9_,]*))\Z/, # decimal
6
+ /\A0[0-7]+\Z/, # octal
7
+ /\A0x[0-9a-f]+\Z/i, # hexadecimal
8
+ /\A0b[01_]+\Z/ # binary
9
9
  ])
10
10
 
11
11
  def transform?(value)
@@ -1,3 +1,3 @@
1
1
  module SafeYAML
2
- VERSION = "0.9.2"
2
+ VERSION = "0.9.3"
3
3
  end
@@ -29,6 +29,10 @@ describe SafeYAML::Transform::ToInteger do
29
29
  subject.transform?("09").should be_false
30
30
  end
31
31
 
32
+ it "correctly parses 0 in decimal" do
33
+ subject.transform?("0").should == [true, 0]
34
+ end
35
+
32
36
  it "defaults to a string for a number that resembles hexadecimal format but is not" do
33
37
  subject.transform?("0x1G").should be_false
34
38
  end
@@ -42,7 +46,7 @@ describe SafeYAML::Transform::ToInteger do
42
46
 
43
47
  # octal
44
48
  subject.transform?("02472256").should == [true, 685230]
45
-
49
+
46
50
  # hexadecimal:
47
51
  subject.transform?("0x_0A_74_AE").should == [true, 685230]
48
52
 
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: safe_yaml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
5
- prerelease:
4
+ version: 0.9.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - Dan Tao
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-05-28 00:00:00.000000000 Z
11
+ date: 2013-06-06 00:00:00.000000000 Z
13
12
  dependencies: []
14
13
  description: Parse YAML safely, without that pesky arbitrary object deserialization
15
14
  vulnerability
@@ -64,27 +63,26 @@ files:
64
63
  homepage: http://dtao.github.com/safe_yaml/
65
64
  licenses:
66
65
  - MIT
66
+ metadata: {}
67
67
  post_install_message:
68
68
  rdoc_options: []
69
69
  require_paths:
70
70
  - lib
71
71
  required_ruby_version: !ruby/object:Gem::Requirement
72
- none: false
73
72
  requirements:
74
73
  - - ! '>='
75
74
  - !ruby/object:Gem::Version
76
75
  version: 1.8.7
77
76
  required_rubygems_version: !ruby/object:Gem::Requirement
78
- none: false
79
77
  requirements:
80
78
  - - ! '>='
81
79
  - !ruby/object:Gem::Version
82
80
  version: '0'
83
81
  requirements: []
84
82
  rubyforge_project:
85
- rubygems_version: 1.8.25
83
+ rubygems_version: 2.0.3
86
84
  signing_key:
87
- specification_version: 3
85
+ specification_version: 4
88
86
  summary: SameYAML provides an alternative implementation of YAML.load suitable for
89
87
  accepting user input in Ruby applications.
90
88
  test_files: