multi_json 1.9.3 → 1.10.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: 7c2a387cf1082722ed68ed290ba53909de8fa882
4
- data.tar.gz: d06db47576a3cb2801b12af6d15fbd227facc800
3
+ metadata.gz: e9e80b3da1939ae507958fa22e0212cb5156d8de
4
+ data.tar.gz: 62cf542ccfea9291b606484c4b3821b04f0f4553
5
5
  SHA512:
6
- metadata.gz: dab04d4d5f9f3bcda964d379a9d9fee49cd09b2a72cf5ecf67d3f1be339f12e4a54c8fae1269b07437d4be0b87f93c8ef3719bd74b2096fb75a9db69d3ecd6a5
7
- data.tar.gz: 723e745ecc160b1ae47ea0e35b79d0833b8c65549b787c8f3e2b2e9ae26055239a2d0cac18b1b3a637cdf5b7778d99ed0ee91f116e55156e1c304146b7558110
6
+ metadata.gz: 5be5ee5ddcf2c0227718423a55424ac679b5a031b4972106f247d5ee4c02761bac842f89cb69935f9aa493ef1a617a218894353b7ef11e8e5feb30b01977af4e
7
+ data.tar.gz: 38562e8b713275e6eb7dd49217f92007a906801d32e52acb8c85c880367a547e2a15a499aa7967d806e103f3b0f3d445f07451aa7de1e87406ba7b33baa427b0
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/.travis.yml CHANGED
@@ -1,11 +1,10 @@
1
1
  bundler_args: --without development
2
2
  language: ruby
3
3
  rvm:
4
- - 1.8.7
4
+ - 1.8.7-p374
5
5
  - 1.9.2
6
6
  - 1.9.3
7
7
  - 2.0.0
8
- - 2.1.0
9
8
  - 2.1.1
10
9
  - jruby-18mode
11
10
  - jruby-19mode
@@ -14,6 +13,7 @@ rvm:
14
13
  - ruby-head
15
14
  matrix:
16
15
  allow_failures:
16
+ - rvm: rbx-2
17
17
  - rvm: jruby-head
18
18
  - rvm: ruby-head
19
19
  fast_finish: true
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ 1.10.0
2
+ ------
3
+ * [Performance tweaks](https://github.com/intridea/multi_json/commit/58724acfed31866d079eaafb1cd824e341ade287)
4
+
1
5
  1.9.3
2
6
  -----
3
7
  * [Convert indent option to Fixnum before passing to Oj](https://github.com/intridea/multi_json/commit/826fc5535b863b74fc9f981dfdda3e26f1ee4e5b)
data/Gemfile CHANGED
@@ -14,7 +14,6 @@ end
14
14
 
15
15
  group :test do
16
16
  gem 'rspec', '>= 2.14'
17
- gem 'simplecov', :require => false
18
17
  end
19
18
 
20
19
  platforms :jruby do
@@ -23,7 +22,7 @@ platforms :jruby do
23
22
  end
24
23
 
25
24
  platforms :mingw, :mswin, :ruby do
26
- gem 'oj', '~> 2.8', :require => nil
25
+ gem 'oj', '~> 2.9', :require => nil
27
26
  gem 'yajl-ruby', '~> 1.0', :require => nil
28
27
  end
29
28
 
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # MultiJSON
2
2
 
3
- [![Gem Version](http://img.shields.io/gem/v/multi_json.svg)][gem]
3
+ [![Gem Version](https://travis-ci.org/intridea/multi_json.svg)][gem]
4
4
  [![Build Status](http://img.shields.io/travis/intridea/multi_json.svg)][travis]
5
5
  [![Dependency Status](http://img.shields.io/gemnasium/intridea/multi_json.svg)][gemnasium]
6
6
  [![Code Climate](http://img.shields.io/codeclimate/github/intridea/multi_json.svg)][codeclimate]
@@ -72,7 +72,6 @@ implementations:
72
72
  * Ruby 1.9.2
73
73
  * Ruby 1.9.3
74
74
  * Ruby 2.0.0
75
- * Ruby 2.1.0
76
75
  * Ruby 2.1.1
77
76
  * [JRuby][]
78
77
  * [Rubinius][]
data/lib/multi_json.rb CHANGED
@@ -7,21 +7,6 @@ module MultiJson
7
7
  include Options
8
8
  extend self
9
9
 
10
- class << self
11
- def cached_options
12
- @cached_options ||= {}
13
- end
14
-
15
- def reset_cached_options!
16
- @cached_options = {}
17
- end
18
- end
19
-
20
- # Since `default_options` is deprecated, the
21
- # reader is aliased to `dump_options` and the
22
- # writer sets both `dump_options` and `load_options`
23
- alias default_options dump_options
24
-
25
10
  def default_options=(value)
26
11
  Kernel.warn "MultiJson.default_options setter is deprecated\n" +
27
12
  "Use MultiJson.load_options and MultiJson.dump_options instead"
@@ -29,6 +14,19 @@ module MultiJson
29
14
  self.load_options = self.dump_options = value
30
15
  end
31
16
 
17
+ def default_options
18
+ Kernel.warn "MultiJson.default_options is deprecated\n" +
19
+ "Use MultiJson.load_options or MultiJson.dump_options instead"
20
+
21
+ self.load_options
22
+ end
23
+
24
+ %w[cached_options reset_cached_options!].each do |method_name|
25
+ define_method method_name do |*|
26
+ Kernel.warn "MultiJson.#{method_name} method is deprecated and no longer used."
27
+ end
28
+ end
29
+
32
30
  ALIASES = { 'jrjackson' => 'jr_jackson' }
33
31
 
34
32
  REQUIREMENT_MAP = [
@@ -17,31 +17,11 @@ module MultiJson
17
17
 
18
18
  def load(string, options={})
19
19
  raise self::ParseError if blank?(string)
20
- instance.load(string, collect_load_options(options).clone)
20
+ instance.load(string, load_options(options).merge(MultiJson.load_options(options)).merge!(options))
21
21
  end
22
22
 
23
23
  def dump(object, options={})
24
- instance.dump(object, collect_dump_options(options).clone)
25
- end
26
-
27
- protected
28
-
29
- def collect_load_options(options)
30
- cache('load', options){ collect_options(:load_options, options).merge(options) }
31
- end
32
-
33
- def collect_dump_options(options)
34
- cache('dump', options){ collect_options(:dump_options, options).merge(options) }
35
- end
36
-
37
- def collect_options(method, *args)
38
- global, local = *[MultiJson, self].map{ |r| r.send(method, *args) }
39
- local.merge(global)
40
- end
41
-
42
- def cache(method, options)
43
- cache_key = [self, options].map(&:hash).join + method
44
- MultiJson.cached_options[cache_key] ||= yield
24
+ instance.dump(object, dump_options(options).merge(MultiJson.dump_options(options)).merge!(options))
45
25
  end
46
26
 
47
27
  private
@@ -2,21 +2,19 @@ module MultiJson
2
2
  module Options
3
3
 
4
4
  def load_options=(options)
5
- MultiJson.reset_cached_options!
6
5
  @load_options = options
7
6
  end
8
7
 
9
8
  def dump_options=(options)
10
- MultiJson.reset_cached_options!
11
9
  @dump_options = options
12
10
  end
13
11
 
14
12
  def load_options(*args)
15
- get_options :load_options, *args
13
+ defined?(@load_options) && get_options(@load_options, *args) || default_load_options
16
14
  end
17
15
 
18
16
  def dump_options(*args)
19
- get_options :dump_options, *args
17
+ defined?(@dump_options) && get_options(@dump_options, *args) || default_dump_options
20
18
  end
21
19
 
22
20
  def default_load_options
@@ -29,19 +27,11 @@ module MultiJson
29
27
 
30
28
  private
31
29
 
32
- def get_options(ivar, *args)
33
- defaults = send("default_#{ivar}")
34
-
35
- return defaults unless instance_variable_defined?("@#{ivar}")
36
-
37
- value = instance_variable_get("@#{ivar}")
38
-
39
- if value.respond_to?(:call) and value.arity
40
- value.arity == 0 ? value[] : value[*args]
41
- elsif Hash === value or value.respond_to?(:to_hash)
42
- value.to_hash
43
- else
44
- defaults
30
+ def get_options(options, *args)
31
+ if options.respond_to?(:call) and options.arity
32
+ options.arity == 0 ? options[] : options[*args]
33
+ elsif Hash === options or options.respond_to?(:to_hash)
34
+ options.to_hash
45
35
  end
46
36
  end
47
37
  end
@@ -1,9 +1,9 @@
1
1
  module MultiJson
2
2
  class Version
3
- MAJOR = 1 unless defined? MultiJson::Version::MAJOR
4
- MINOR = 9 unless defined? MultiJson::Version::MINOR
5
- PATCH = 3 unless defined? MultiJson::Version::PATCH
6
- PRE = nil unless defined? MultiJson::Version::PRE
3
+ MAJOR = 1 unless defined? MultiJson::Version::MAJOR
4
+ MINOR = 10 unless defined? MultiJson::Version::MINOR
5
+ PATCH = 0 unless defined? MultiJson::Version::PATCH
6
+ PRE = nil unless defined? MultiJson::Version::PRE
7
7
 
8
8
  class << self
9
9
 
data/spec/spec_helper.rb CHANGED
@@ -1,15 +1,3 @@
1
- require 'simplecov'
2
- # require 'coveralls'
3
-
4
- # SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
5
- # SimpleCov::Formatter::HTMLFormatter,
6
- # Coveralls::SimpleCov::Formatter
7
- # ]
8
- # SimpleCov.start do
9
- # add_filter 'spec'
10
- # add_filter 'vendor'
11
- # end
12
-
13
1
  require 'multi_json'
14
2
  require 'rspec'
15
3
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: multi_json
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.3
4
+ version: 1.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Bleigh
@@ -33,20 +33,20 @@ cert_chain:
33
33
  7BTxdlSpJZDcAK29Ni3NRCRu6Air4wfDln0Ilzeuut6cJ4/j2/RlvsccVSRaEfOa
34
34
  wM7GTK5SEdU3qelyBdc4+RRs6uU=
35
35
  -----END CERTIFICATE-----
36
- date: 2014-04-27 00:00:00.000000000 Z
36
+ date: 2014-05-06 00:00:00.000000000 Z
37
37
  dependencies:
38
38
  - !ruby/object:Gem::Dependency
39
39
  name: bundler
40
40
  requirement: !ruby/object:Gem::Requirement
41
41
  requirements:
42
- - - ~>
42
+ - - "~>"
43
43
  - !ruby/object:Gem::Version
44
44
  version: '1.0'
45
45
  type: :development
46
46
  prerelease: false
47
47
  version_requirements: !ruby/object:Gem::Requirement
48
48
  requirements:
49
- - - ~>
49
+ - - "~>"
50
50
  - !ruby/object:Gem::Version
51
51
  version: '1.0'
52
52
  description: A common interface to multiple JSON libraries, including Oj, Yajl, the
@@ -60,10 +60,10 @@ executables: []
60
60
  extensions: []
61
61
  extra_rdoc_files: []
62
62
  files:
63
- - .document
64
- - .rspec
65
- - .travis.yml
66
- - .yardopts
63
+ - ".document"
64
+ - ".rspec"
65
+ - ".travis.yml"
66
+ - ".yardopts"
67
67
  - CHANGELOG.md
68
68
  - CONTRIBUTING.md
69
69
  - Gemfile
@@ -111,12 +111,12 @@ require_paths:
111
111
  - lib
112
112
  required_ruby_version: !ruby/object:Gem::Requirement
113
113
  requirements:
114
- - - '>='
114
+ - - ">="
115
115
  - !ruby/object:Gem::Version
116
116
  version: '0'
117
117
  required_rubygems_version: !ruby/object:Gem::Requirement
118
118
  requirements:
119
- - - '>='
119
+ - - ">="
120
120
  - !ruby/object:Gem::Version
121
121
  version: 1.3.5
122
122
  requirements: []
metadata.gz.sig CHANGED
Binary file