usamin 7.7.9 → 7.7.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,14 @@
1
+ #include "usamin_value.hpp"
2
+ #include <ruby.h>
3
+ #include "rubynized_rapidjson.hpp"
4
+
5
+ UsaminValue::UsaminValue(RubynizedValue *value, const bool free_flag, const VALUE root_document) {
6
+ this->value = value;
7
+ this->free_flag = free_flag;
8
+ this->root_document = root_document;
9
+ }
10
+
11
+ UsaminValue::~UsaminValue() {
12
+ if (value && free_flag)
13
+ delete (RubynizedDocument *)value;
14
+ }
@@ -0,0 +1,17 @@
1
+ #ifndef USAMIN_USAMIN_VALUE_HPP
2
+ #define USAMIN_USAMIN_VALUE_HPP
3
+
4
+ #include <ruby.h>
5
+ #include "rubynized_rapidjson.hpp"
6
+
7
+ class UsaminValue {
8
+ public:
9
+ RubynizedValue *value;
10
+ VALUE root_document;
11
+ bool free_flag;
12
+
13
+ UsaminValue(RubynizedValue *value = nullptr, const bool free_flag = false, const VALUE root_document = Qnil);
14
+ ~UsaminValue();
15
+ };
16
+
17
+ #endif
data/lib/usamin.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'usamin/version'
2
4
  require 'usamin/usamin'
3
5
 
@@ -1,40 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'json'
1
4
  require 'usamin'
2
5
 
3
6
  module JSON
4
- def self.generate(object, **options)
5
- options[:indent] ? Usamin.pretty_generate(object, indent: options[:indent]) : Usamin.generate(object)
6
- end
7
+ def self.generate(object, **options)
8
+ options[:indent] ? Usamin.pretty_generate(object, indent: options[:indent]) : Usamin.generate(object)
9
+ end
7
10
 
8
- def self.pretty_generate(object, **options)
9
- options[:indent] ? Usamin.pretty_generate(object, indent: options[:indent]) : Usamin.pretty_generate(object)
10
- end
11
+ def self.pretty_generate(object, **options)
12
+ options[:indent] ? Usamin.pretty_generate(object, indent: options[:indent]) : Usamin.pretty_generate(object)
13
+ end
11
14
 
12
- def self.parse(source, **options)
13
- Usamin.parse(source)
15
+ def self.parse(source, **options)
16
+ begin
17
+ Usamin.parse(source, symbolize_names: options[:symbolize_names])
18
+ rescue Usamin::ParserError
19
+ raise JSON::ParserError.new($!.message)
14
20
  end
21
+ end
15
22
 
16
- def self.load(source, proc = nil, **options)
17
- ret = Usamin.parse(source)
18
- LoadProcCaller.load_call_proc(ret, proc) if proc
19
- ret
20
- end
23
+ def self.load(source, proc = nil, **options)
24
+ ret = Usamin.parse(source, **options)
25
+ LoadProcCaller.load_call_proc(ret, proc) if proc
26
+ ret
27
+ end
21
28
 
22
- class LoadProcCaller
23
- def self.load_call_proc(object, proc)
24
- if object.is_a?(Array)
25
- object.each{|e| load_call_proc(e, proc)}
26
- elsif object.is_a?(Hash)
27
- object.each do |k, v|
28
- proc.call(k)
29
- load_call_proc(v, proc)
30
- end
31
- end
32
- proc.call(object)
29
+ class LoadProcCaller
30
+ def self.load_call_proc(object, proc)
31
+ if object.is_a?(Array)
32
+ object.each{|e| load_call_proc(e, proc)}
33
+ elsif object.is_a?(Hash)
34
+ object.each do |k, v|
35
+ proc.call(k)
36
+ load_call_proc(v, proc)
33
37
  end
38
+ end
39
+ proc.call(object)
34
40
  end
41
+ end
35
42
 
36
- class << self
37
- alias fast_generate generate
38
- alias restore load
39
- end
43
+ class << self
44
+ alias fast_generate generate
45
+ alias restore load
46
+ end
40
47
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Usamin
2
- VERSION = '7.7.9'.freeze
4
+ VERSION = '7.7.10'
3
5
  end
data/usamin.gemspec CHANGED
@@ -1,29 +1,30 @@
1
+ # frozen_string_literal: true
1
2
 
2
- lib = File.expand_path("../lib", __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require "usamin/version"
3
+ lib = File.expand_path('lib', __dir__)
4
+ $:.unshift(lib) unless $:.include?(lib)
5
+ require 'usamin/version'
5
6
 
6
7
  Gem::Specification.new do |spec|
7
- spec.name = "usamin"
8
+ spec.name = 'usamin'
8
9
  spec.version = Usamin::VERSION
9
- spec.authors = ["Ishotihadus"]
10
- spec.email = ["hanachan.pao@gmail.com"]
10
+ spec.authors = ['Ishotihadus']
11
+ spec.email = ['hanachan.pao@gmail.com']
11
12
 
12
- spec.summary = "A RapidJSON Wrapper for Ruby"
13
- spec.description = "A fast JSON serializer / deserializer for Ruby with RapidJSON."
14
- spec.homepage = "https://github.com/Ishotihadus/usamin"
15
- spec.license = "MIT"
13
+ spec.summary = 'A RapidJSON Wrapper for Ruby'
14
+ spec.description = 'A fast JSON serializer / deserializer for Ruby with RapidJSON.'
15
+ spec.homepage = 'https://github.com/Ishotihadus/usamin'
16
+ spec.license = 'MIT'
16
17
 
17
18
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
19
  f.match(%r{^(test|spec|features)/})
19
20
  end
20
- spec.bindir = "exe"
21
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
- spec.require_paths = ["lib"]
23
- spec.extensions = ["ext/usamin/extconf.rb"]
21
+ spec.bindir = 'exe'
22
+ spec.executables = spec.files.grep(%r{^exe/}) {|f| File.basename(f)}
23
+ spec.require_paths = ['lib']
24
+ spec.extensions = ['ext/usamin/extconf.rb']
24
25
 
25
- spec.add_development_dependency "bundler"
26
- spec.add_development_dependency "rake"
27
- spec.add_development_dependency "rake-compiler"
28
- spec.add_development_dependency "pry"
26
+ spec.add_development_dependency 'bundler'
27
+ spec.add_development_dependency 'pry'
28
+ spec.add_development_dependency 'rake'
29
+ spec.add_development_dependency 'rake-compiler'
29
30
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: usamin
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.7.9
4
+ version: 7.7.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ishotihadus
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-08-03 00:00:00.000000000 Z
11
+ date: 2019-12-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -25,7 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rake
28
+ name: pry
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
@@ -39,7 +39,7 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: rake-compiler
42
+ name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
@@ -53,7 +53,7 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: pry
56
+ name: rake-compiler
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
@@ -82,8 +82,26 @@ files:
82
82
  - Rakefile
83
83
  - bin/console
84
84
  - bin/setup
85
+ - ext/usamin/default_parse_flags.hpp
85
86
  - ext/usamin/extconf.rb
87
+ - ext/usamin/generator.cpp
88
+ - ext/usamin/generator.hpp
89
+ - ext/usamin/parser.cpp
90
+ - ext/usamin/parser.hpp
91
+ - ext/usamin/parser_helper.hpp
92
+ - ext/usamin/rb_common.cpp
93
+ - ext/usamin/rb_common.hpp
94
+ - ext/usamin/rb_usamin_array.cpp
95
+ - ext/usamin/rb_usamin_array.hpp
96
+ - ext/usamin/rb_usamin_hash.cpp
97
+ - ext/usamin/rb_usamin_hash.hpp
98
+ - ext/usamin/rb_usamin_value.cpp
99
+ - ext/usamin/rb_usamin_value.hpp
100
+ - ext/usamin/rubynized_rapidjson.cpp
101
+ - ext/usamin/rubynized_rapidjson.hpp
86
102
  - ext/usamin/usamin.cpp
103
+ - ext/usamin/usamin_value.cpp
104
+ - ext/usamin/usamin_value.hpp
87
105
  - lib/usamin.rb
88
106
  - lib/usamin/overwrite.rb
89
107
  - lib/usamin/version.rb
@@ -107,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
125
  - !ruby/object:Gem::Version
108
126
  version: '0'
109
127
  requirements: []
110
- rubygems_version: 3.0.3
128
+ rubygems_version: 3.1.2
111
129
  signing_key:
112
130
  specification_version: 4
113
131
  summary: A RapidJSON Wrapper for Ruby