jsonbuilder 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -10,7 +10,7 @@ begin
10
10
  gem.email = 'nov@matake.jp'
11
11
  gem.homepage = 'http://github.com/nov/jsonbuilder'
12
12
  gem.authors = ['nov matake']
13
- gem.add_dependency 'activesupport'
13
+ gem.add_dependency 'activesupport', '>=2.3.2'
14
14
  gem.add_development_dependency 'rspec'
15
15
  gem.add_development_dependency 'rcov'
16
16
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.3.1
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{jsonbuilder}
8
- s.version = "0.3.0"
8
+ s.version = "0.3.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["nov matake"]
12
- s.date = %q{2010-05-19}
12
+ s.date = %q{2010-08-11}
13
13
  s.description = %q{Builder::XmlMarkup like JsonBuilder}
14
14
  s.email = %q{nov@matake.jp}
15
15
  s.extra_rdoc_files = [
@@ -30,7 +30,6 @@ Gem::Specification.new do |s|
30
30
  "lib/ext/stackable_array.rb",
31
31
  "lib/ext/stackable_hash.rb",
32
32
  "lib/jsonbuilder.rb",
33
- "lib/patch/active_support_json_decode.rb",
34
33
  "spec/builder/array_mode_spec.rb",
35
34
  "spec/builder/hash_structure_spec.rb",
36
35
  "spec/builder/json_format_spec.rb",
@@ -43,7 +42,7 @@ Gem::Specification.new do |s|
43
42
  s.homepage = %q{http://github.com/nov/jsonbuilder}
44
43
  s.rdoc_options = ["--charset=UTF-8"]
45
44
  s.require_paths = ["lib"]
46
- s.rubygems_version = %q{1.3.6}
45
+ s.rubygems_version = %q{1.3.7}
47
46
  s.summary = %q{Builder::XmlMarkup like JsonBuilder}
48
47
  s.test_files = [
49
48
  "spec/builder/array_mode_spec.rb",
@@ -59,17 +58,17 @@ Gem::Specification.new do |s|
59
58
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
60
59
  s.specification_version = 3
61
60
 
62
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
63
- s.add_runtime_dependency(%q<activesupport>, [">= 0"])
61
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
62
+ s.add_runtime_dependency(%q<activesupport>, [">= 2.3.2"])
64
63
  s.add_development_dependency(%q<rspec>, [">= 0"])
65
64
  s.add_development_dependency(%q<rcov>, [">= 0"])
66
65
  else
67
- s.add_dependency(%q<activesupport>, [">= 0"])
66
+ s.add_dependency(%q<activesupport>, [">= 2.3.2"])
68
67
  s.add_dependency(%q<rspec>, [">= 0"])
69
68
  s.add_dependency(%q<rcov>, [">= 0"])
70
69
  end
71
70
  else
72
- s.add_dependency(%q<activesupport>, [">= 0"])
71
+ s.add_dependency(%q<activesupport>, [">= 2.3.2"])
73
72
  s.add_dependency(%q<rspec>, [">= 0"])
74
73
  s.add_dependency(%q<rcov>, [">= 0"])
75
74
  end
@@ -1,4 +1,5 @@
1
- require 'patch/active_support_json_decode'
1
+ require 'active_support/core_ext'
2
+ require 'active_support/json'
2
3
 
3
4
  module Builder
4
5
  class JsonFormat < HashStructure
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsonbuilder
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 17
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
8
  - 3
8
- - 0
9
- version: 0.3.0
9
+ - 1
10
+ version: 0.3.1
10
11
  platform: ruby
11
12
  authors:
12
13
  - nov matake
@@ -14,28 +15,34 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-05-19 00:00:00 +09:00
18
+ date: 2010-08-11 00:00:00 +09:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: activesupport
22
23
  prerelease: false
23
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
24
26
  requirements:
25
27
  - - ">="
26
28
  - !ruby/object:Gem::Version
29
+ hash: 7
27
30
  segments:
28
- - 0
29
- version: "0"
31
+ - 2
32
+ - 3
33
+ - 2
34
+ version: 2.3.2
30
35
  type: :runtime
31
36
  version_requirements: *id001
32
37
  - !ruby/object:Gem::Dependency
33
38
  name: rspec
34
39
  prerelease: false
35
40
  requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
36
42
  requirements:
37
43
  - - ">="
38
44
  - !ruby/object:Gem::Version
45
+ hash: 3
39
46
  segments:
40
47
  - 0
41
48
  version: "0"
@@ -45,9 +52,11 @@ dependencies:
45
52
  name: rcov
46
53
  prerelease: false
47
54
  requirement: &id003 !ruby/object:Gem::Requirement
55
+ none: false
48
56
  requirements:
49
57
  - - ">="
50
58
  - !ruby/object:Gem::Version
59
+ hash: 3
51
60
  segments:
52
61
  - 0
53
62
  version: "0"
@@ -76,7 +85,6 @@ files:
76
85
  - lib/ext/stackable_array.rb
77
86
  - lib/ext/stackable_hash.rb
78
87
  - lib/jsonbuilder.rb
79
- - lib/patch/active_support_json_decode.rb
80
88
  - spec/builder/array_mode_spec.rb
81
89
  - spec/builder/hash_structure_spec.rb
82
90
  - spec/builder/json_format_spec.rb
@@ -95,23 +103,27 @@ rdoc_options:
95
103
  require_paths:
96
104
  - lib
97
105
  required_ruby_version: !ruby/object:Gem::Requirement
106
+ none: false
98
107
  requirements:
99
108
  - - ">="
100
109
  - !ruby/object:Gem::Version
110
+ hash: 3
101
111
  segments:
102
112
  - 0
103
113
  version: "0"
104
114
  required_rubygems_version: !ruby/object:Gem::Requirement
115
+ none: false
105
116
  requirements:
106
117
  - - ">="
107
118
  - !ruby/object:Gem::Version
119
+ hash: 3
108
120
  segments:
109
121
  - 0
110
122
  version: "0"
111
123
  requirements: []
112
124
 
113
125
  rubyforge_project:
114
- rubygems_version: 1.3.6
126
+ rubygems_version: 1.3.7
115
127
  signing_key:
116
128
  specification_version: 3
117
129
  summary: Builder::XmlMarkup like JsonBuilder
@@ -1,87 +0,0 @@
1
- # Copy of rails 2.3.2 ActiveSupport::JSON since 2.2.2 doesn't correctly decode unicode.
2
- require 'yaml'
3
- require 'strscan'
4
- require 'active_support/core_ext'
5
- require 'active_support/json'
6
-
7
- silence_warnings {
8
- module ActiveSupport
9
- module JSON
10
- class ParseError < StandardError
11
- end
12
-
13
- class << self
14
- # Converts a JSON string into a Ruby object.
15
- def decode(json)
16
- YAML.load(convert_json_to_yaml(json))
17
- rescue ArgumentError => e
18
- raise ParseError, "Invalid JSON string"
19
- end
20
-
21
- protected
22
- # matches YAML-formatted dates
23
- DATE_REGEX = /^(?:\d{4}-\d{2}-\d{2}|\d{4}-\d{1,2}-\d{1,2}[ \t]+\d{1,2}:\d{2}:\d{2}(\.[0-9]*)?(([ \t]*)Z|[-+]\d{2}?(:\d{2})?)?)$/
24
-
25
- # Ensure that ":" and "," are always followed by a space
26
- def convert_json_to_yaml(json) #:nodoc:
27
- scanner, quoting, marks, pos, times = StringScanner.new(json), false, [], nil, []
28
- while scanner.scan_until(/(\\['"]|['":,\\]|\\.)/)
29
- case char = scanner[1]
30
- when '"', "'"
31
- if !quoting
32
- quoting = char
33
- pos = scanner.pos
34
- elsif quoting == char
35
- if json[pos..scanner.pos-2] =~ DATE_REGEX
36
- # found a date, track the exact positions of the quotes so we can remove them later.
37
- # oh, and increment them for each current mark, each one is an extra padded space that bumps
38
- # the position in the final YAML output
39
- total_marks = marks.size
40
- times << pos+total_marks << scanner.pos+total_marks
41
- end
42
- quoting = false
43
- end
44
- when ":",","
45
- marks << scanner.pos - 1 unless quoting
46
- end
47
- end
48
-
49
- if marks.empty?
50
- json.gsub(/\\([\\\/]|u[[:xdigit:]]{4})/) do
51
- ustr = $1
52
- if ustr.starts_with?('u')
53
- [ustr[1..-1].to_i(16)].pack("U")
54
- elsif ustr == '\\'
55
- '\\\\'
56
- else
57
- ustr
58
- end
59
- end
60
- else
61
- left_pos = [-1].push(*marks)
62
- right_pos = marks << scanner.pos + scanner.rest_size
63
- output = []
64
- left_pos.each_with_index do |left, i|
65
- scanner.pos = left.succ
66
- output << scanner.peek(right_pos[i] - scanner.pos + 1).gsub(/\\([\\\/]|u[[:xdigit:]]{4})/) do
67
- ustr = $1
68
- if ustr.starts_with?('u')
69
- [ustr[1..-1].to_i(16)].pack("U")
70
- elsif ustr == '\\'
71
- '\\\\'
72
- else
73
- ustr
74
- end
75
- end
76
- end
77
- output = output * " "
78
-
79
- times.each { |i| output[i-1] = ' ' }
80
- output.gsub!(/\\\//, '/')
81
- output
82
- end
83
- end
84
- end
85
- end
86
- end
87
- }