oj-introspect 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +15 -0
- data/.rspec +3 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +47 -0
- data/LICENSE.txt +21 -0
- data/README.md +44 -0
- data/Rakefile +12 -0
- data/bin/benchmark +27 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/bin/test_run +8 -0
- data/ext/oj-introspect/extconf.rb +10 -0
- data/ext/oj-introspect/introspect.c +194 -0
- data/lib/oj/introspect/version.rb +5 -0
- data/lib/oj/introspect.rb +9 -0
- data/oj-introspect.gemspec +27 -0
- metadata +75 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e9fc62ff35dbc50422ea8578a2f053c6c1d5036c071bfe46b5d5d3a34e5a8c7a
|
4
|
+
data.tar.gz: 5106fd71458d000cb2cb06cb0a85f696ab5c6f83327198470e7ce2bf01311a09
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b1dd55782690a0186360b503ebc915eb817d4d9d5257a833653d7a6678d0d7cbf7ad85db8d847bff23dec8ef07de27b6119af5daac7e1ac4a5fd034636e6cbb5
|
7
|
+
data.tar.gz: 88e31090edbb71d09865ae92ddf28cb0559b793836262cfa7440bbea56134c2d2c309064a86cf20c320e65277102c90369393a8016bdb590492db2aead08eeb1
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at mehmetemininac@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [https://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: https://contributor-covenant.org
|
74
|
+
[version]: https://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
oj-introspect (0.1.0)
|
5
|
+
oj (~> 3.13)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
benchmark-ips (2.10.0)
|
11
|
+
coderay (1.1.3)
|
12
|
+
diff-lcs (1.5.0)
|
13
|
+
method_source (1.0.0)
|
14
|
+
oj (3.13.22)
|
15
|
+
pry (0.14.1)
|
16
|
+
coderay (~> 1.1)
|
17
|
+
method_source (~> 1.0)
|
18
|
+
rake (12.3.3)
|
19
|
+
rake-compiler (1.2.0)
|
20
|
+
rake
|
21
|
+
rspec (3.12.0)
|
22
|
+
rspec-core (~> 3.12.0)
|
23
|
+
rspec-expectations (~> 3.12.0)
|
24
|
+
rspec-mocks (~> 3.12.0)
|
25
|
+
rspec-core (3.12.0)
|
26
|
+
rspec-support (~> 3.12.0)
|
27
|
+
rspec-expectations (3.12.0)
|
28
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
29
|
+
rspec-support (~> 3.12.0)
|
30
|
+
rspec-mocks (3.12.0)
|
31
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
32
|
+
rspec-support (~> 3.12.0)
|
33
|
+
rspec-support (3.12.0)
|
34
|
+
|
35
|
+
PLATFORMS
|
36
|
+
ruby
|
37
|
+
|
38
|
+
DEPENDENCIES
|
39
|
+
benchmark-ips
|
40
|
+
oj-introspect!
|
41
|
+
pry
|
42
|
+
rake (~> 12.0)
|
43
|
+
rake-compiler
|
44
|
+
rspec (~> 3.0)
|
45
|
+
|
46
|
+
BUNDLED WITH
|
47
|
+
2.1.4
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2022 Mehmet Emin INAC
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
# Oj::Introspect
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/oj/introspect`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'oj-introspect'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle install
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install oj-introspect
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/oj-introspect. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/oj-introspect/blob/master/CODE_OF_CONDUCT.md).
|
36
|
+
|
37
|
+
|
38
|
+
## License
|
39
|
+
|
40
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
41
|
+
|
42
|
+
## Code of Conduct
|
43
|
+
|
44
|
+
Everyone interacting in the Oj::Introspect project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/oj-introspect/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require "rspec/core/rake_task"
|
3
|
+
require "rake/extensiontask"
|
4
|
+
|
5
|
+
RSpec::Core::RakeTask.new(:spec)
|
6
|
+
|
7
|
+
task default: [:compile, :spec]
|
8
|
+
|
9
|
+
Rake::ExtensionTask.new "oj-introspect" do |ext|
|
10
|
+
ext.name = "introspect_ext"
|
11
|
+
ext.lib_dir = "lib/oj/introspect"
|
12
|
+
end
|
data/bin/benchmark
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "oj/introspect"
|
5
|
+
require "json"
|
6
|
+
require "benchmark/ips"
|
7
|
+
|
8
|
+
TEST_JSON = '{ "foo": "bar" }'
|
9
|
+
|
10
|
+
INTROSPECT_PARSER = Oj::Parser.introspect
|
11
|
+
USUAL_PARSER = Oj::Parser.usual
|
12
|
+
|
13
|
+
Benchmark.ips do |b|
|
14
|
+
b.report("Introspected") do
|
15
|
+
INTROSPECT_PARSER.parse(TEST_JSON)
|
16
|
+
end
|
17
|
+
|
18
|
+
b.report("Oj usual") do
|
19
|
+
USUAL_PARSER.parse(TEST_JSON)
|
20
|
+
end
|
21
|
+
|
22
|
+
b.report("stdlib") do
|
23
|
+
JSON.parse(TEST_JSON)
|
24
|
+
end
|
25
|
+
|
26
|
+
b.compare!
|
27
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "oj/introspect"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/bin/test_run
ADDED
@@ -0,0 +1,194 @@
|
|
1
|
+
#include <ruby.h>
|
2
|
+
#include "oj.h"
|
3
|
+
#include "parser.h"
|
4
|
+
#include "usual.h"
|
5
|
+
|
6
|
+
#define BYTE_OFFSETS_STACK_INC_SIZE 256
|
7
|
+
|
8
|
+
// Holds the start byte offsets of each JSON object encountered
|
9
|
+
struct _byte_offsets {
|
10
|
+
int length;
|
11
|
+
int current;
|
12
|
+
long *stack;
|
13
|
+
};
|
14
|
+
|
15
|
+
typedef struct _introspect_S {
|
16
|
+
struct _usual usual; // inherit all the attributes from `_usual` struct
|
17
|
+
struct _byte_offsets byte_offsets; // I think it's better to encapsulate common fields under a namespace
|
18
|
+
|
19
|
+
void (*delegated_start_func)(struct _ojParser *p);
|
20
|
+
void (*delegated_free_func)(struct _ojParser *p);
|
21
|
+
void (*delegated_open_object_func)(struct _ojParser *p);
|
22
|
+
void (*delegated_open_object_key_func)(struct _ojParser *p);
|
23
|
+
void (*delegated_close_object_func)(struct _ojParser *p);
|
24
|
+
} *IntrospectDelegate;
|
25
|
+
|
26
|
+
static void dfree(ojParser p) {
|
27
|
+
IntrospectDelegate d = (IntrospectDelegate)p->ctx;
|
28
|
+
|
29
|
+
xfree(d->byte_offsets.stack);
|
30
|
+
d->delegated_free_func(p);
|
31
|
+
}
|
32
|
+
|
33
|
+
static void start(ojParser p) {
|
34
|
+
IntrospectDelegate d = (IntrospectDelegate)p->ctx;
|
35
|
+
|
36
|
+
d->delegated_start_func(p);
|
37
|
+
// Reset to zero so the parser and delegate can be reused.
|
38
|
+
d->byte_offsets.current = 0;
|
39
|
+
}
|
40
|
+
|
41
|
+
static void ensure_byte_offsets_stack(IntrospectDelegate d) {
|
42
|
+
if (RB_UNLIKELY(d->byte_offsets.current == (d->byte_offsets.length - 1))) {
|
43
|
+
d->byte_offsets.length += BYTE_OFFSETS_STACK_INC_SIZE;
|
44
|
+
REALLOC_N(d->byte_offsets.stack, long, d->byte_offsets.length + BYTE_OFFSETS_STACK_INC_SIZE);
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
48
|
+
static long pop(ojParser p) {
|
49
|
+
IntrospectDelegate d = (IntrospectDelegate)p->ctx;
|
50
|
+
|
51
|
+
return d->byte_offsets.stack[--d->byte_offsets.current];
|
52
|
+
}
|
53
|
+
|
54
|
+
static void push(ojParser p) {
|
55
|
+
IntrospectDelegate d = (IntrospectDelegate)p->ctx;
|
56
|
+
ensure_byte_offsets_stack(d);
|
57
|
+
|
58
|
+
d->byte_offsets.stack[d->byte_offsets.current++] = p->cur;
|
59
|
+
}
|
60
|
+
|
61
|
+
static void open_object_introspected(ojParser p) {
|
62
|
+
push(p);
|
63
|
+
|
64
|
+
IntrospectDelegate d = (IntrospectDelegate)p->ctx;
|
65
|
+
d->delegated_open_object_func(p);
|
66
|
+
}
|
67
|
+
|
68
|
+
static void open_object_key_introspected(ojParser p) {
|
69
|
+
push(p);
|
70
|
+
|
71
|
+
IntrospectDelegate d = (IntrospectDelegate)p->ctx;
|
72
|
+
d->delegated_open_object_key_func(p);
|
73
|
+
}
|
74
|
+
|
75
|
+
static void set_introspection_values(ojParser p) {
|
76
|
+
IntrospectDelegate d = (IntrospectDelegate)p->ctx;
|
77
|
+
|
78
|
+
volatile VALUE obj = rb_hash_new();
|
79
|
+
rb_hash_aset(obj, ID2SYM(rb_intern("start_byte")), INT2FIX(pop(p)));
|
80
|
+
rb_hash_aset(obj, ID2SYM(rb_intern("end_byte")), INT2FIX(p->cur));
|
81
|
+
rb_hash_aset(*(d->usual.vtail - 1), ID2SYM(rb_intern("__oj_introspection")), obj);
|
82
|
+
}
|
83
|
+
|
84
|
+
static void close_object_introspected(ojParser p) {
|
85
|
+
IntrospectDelegate d = (IntrospectDelegate)p->ctx;
|
86
|
+
d->delegated_close_object_func(p);
|
87
|
+
|
88
|
+
set_introspection_values(p);
|
89
|
+
}
|
90
|
+
|
91
|
+
static void init_introspect_parser(ojParser p, VALUE ropts) {
|
92
|
+
IntrospectDelegate d = ALLOC(struct _introspect_S);
|
93
|
+
|
94
|
+
oj_init_usual(p, (Usual)d);
|
95
|
+
|
96
|
+
// now function mangling...
|
97
|
+
d->delegated_free_func = p->free;
|
98
|
+
p->free = &dfree;
|
99
|
+
|
100
|
+
d->delegated_start_func = p->start;
|
101
|
+
p->start = start;
|
102
|
+
|
103
|
+
// We are cheating with the mark, free, and options functions. Since struct
|
104
|
+
// _usual is the first member of struct _introspect the cast to Usual in the
|
105
|
+
// usual.c mark() function should still work just fine.
|
106
|
+
|
107
|
+
// PCO - do you need the location of sub-objects and arrays or just top
|
108
|
+
// level objects?
|
109
|
+
Funcs f = &p->funcs[TOP_FUN];
|
110
|
+
d->delegated_open_object_func = f->open_object;
|
111
|
+
d->delegated_close_object_func = f->close_object;
|
112
|
+
f->open_object = open_object_introspected;
|
113
|
+
f->close_object = close_object_introspected;
|
114
|
+
|
115
|
+
f = &p->funcs[ARRAY_FUN];
|
116
|
+
f->open_object = open_object_introspected;
|
117
|
+
f->close_object = close_object_introspected;
|
118
|
+
|
119
|
+
f = &p->funcs[OBJECT_FUN];
|
120
|
+
d->delegated_open_object_key_func = f->open_object;
|
121
|
+
f->open_object = open_object_key_introspected;
|
122
|
+
f->close_object = close_object_introspected;
|
123
|
+
|
124
|
+
// Init stack
|
125
|
+
d->byte_offsets.current = 0;
|
126
|
+
d->byte_offsets.stack = ALLOC_N(long, BYTE_OFFSETS_STACK_INC_SIZE);
|
127
|
+
d->byte_offsets.length = BYTE_OFFSETS_STACK_INC_SIZE;
|
128
|
+
|
129
|
+
// Process options.
|
130
|
+
oj_parser_set_option(p, ropts);
|
131
|
+
}
|
132
|
+
|
133
|
+
VALUE oj_get_parser_introspect() {
|
134
|
+
VALUE oj_parser = oj_parser_new();
|
135
|
+
struct _ojParser *p;
|
136
|
+
Data_Get_Struct(oj_parser, struct _ojParser, p);
|
137
|
+
|
138
|
+
init_introspect_parser(p, Qnil);
|
139
|
+
|
140
|
+
rb_gc_register_address(&oj_parser);
|
141
|
+
|
142
|
+
return oj_parser;
|
143
|
+
}
|
144
|
+
|
145
|
+
static VALUE rb_new_introspect_parser(int argc, VALUE *argv, VALUE self) {
|
146
|
+
rb_check_arity(argc, 0, 1);
|
147
|
+
|
148
|
+
VALUE options;
|
149
|
+
|
150
|
+
if(argc == 1) {
|
151
|
+
options = argv[0];
|
152
|
+
|
153
|
+
Check_Type(options, T_HASH);
|
154
|
+
} else {
|
155
|
+
options = rb_hash_new();
|
156
|
+
}
|
157
|
+
|
158
|
+
|
159
|
+
VALUE oj_parser = oj_parser_new();
|
160
|
+
struct _ojParser *p;
|
161
|
+
Data_Get_Struct(oj_parser, struct _ojParser, p);
|
162
|
+
|
163
|
+
init_introspect_parser(p, options);
|
164
|
+
|
165
|
+
// This locks the object in memory and is never recovered. Best to let the
|
166
|
+
// mark function handle it.
|
167
|
+
// rb_gc_register_address(&oj_parser);
|
168
|
+
|
169
|
+
return oj_parser;
|
170
|
+
}
|
171
|
+
|
172
|
+
// This code is neither Ruby Thread safe nor Ractor safe!
|
173
|
+
// I don't really want to write a mutex right now.
|
174
|
+
static VALUE rb_get_default_introspect_parser(VALUE self) {
|
175
|
+
VALUE current_thread = rb_funcall(rb_cThread, rb_intern("current"), 0);
|
176
|
+
VALUE thread_parser = rb_funcall(current_thread, rb_intern("[]"), 1, rb_str_new_literal("oj_introspect_parser"));
|
177
|
+
|
178
|
+
if(RTEST(thread_parser))
|
179
|
+
return thread_parser;
|
180
|
+
|
181
|
+
thread_parser = rb_new_introspect_parser(0, NULL, self);
|
182
|
+
rb_funcall(current_thread, rb_intern("[]="), 2, rb_str_new_literal("oj_introspect_parser"), thread_parser);
|
183
|
+
|
184
|
+
return thread_parser;
|
185
|
+
}
|
186
|
+
|
187
|
+
void Init_introspect_ext() {
|
188
|
+
VALUE oj_module = rb_const_get(rb_cObject, rb_intern("Oj"));
|
189
|
+
VALUE parser_module = rb_const_get(oj_module, rb_intern("Parser"));
|
190
|
+
VALUE introspection_class = rb_define_class_under(oj_module, "Introspect", rb_cObject);
|
191
|
+
|
192
|
+
rb_define_singleton_method(parser_module, "introspect", rb_get_default_introspect_parser, 0);
|
193
|
+
rb_define_singleton_method(introspection_class, "new", rb_new_introspect_parser, -1);
|
194
|
+
}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require_relative 'lib/oj/introspect/version'
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = "oj-introspect"
|
5
|
+
spec.version = Oj::Introspect::VERSION
|
6
|
+
spec.authors = ["Mehmet Emin INAC"]
|
7
|
+
spec.email = ["mehmetemininac@gmail.com"]
|
8
|
+
|
9
|
+
spec.summary = "Oj introspect parser."
|
10
|
+
spec.description = "Embeds start and end byte offsets of JSON objects into generated Ruby hashes."
|
11
|
+
spec.homepage = "https://github.com/meinac/oj-introspect"
|
12
|
+
spec.license = "MIT"
|
13
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
14
|
+
|
15
|
+
# spec.metadata["homepage_uri"] = spec.homepage
|
16
|
+
|
17
|
+
# Specify which files should be added to the gem when it is released.
|
18
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
19
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
20
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
21
|
+
end
|
22
|
+
spec.bindir = "exe"
|
23
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
|
+
spec.require_paths = ["lib"]
|
25
|
+
|
26
|
+
spec.add_dependency "oj", "~>3.13"
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: oj-introspect
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Mehmet Emin INAC
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-11-02 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: oj
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.13'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.13'
|
27
|
+
description: Embeds start and end byte offsets of JSON objects into generated Ruby
|
28
|
+
hashes.
|
29
|
+
email:
|
30
|
+
- mehmetemininac@gmail.com
|
31
|
+
executables: []
|
32
|
+
extensions: []
|
33
|
+
extra_rdoc_files: []
|
34
|
+
files:
|
35
|
+
- ".gitignore"
|
36
|
+
- ".rspec"
|
37
|
+
- CODE_OF_CONDUCT.md
|
38
|
+
- Gemfile
|
39
|
+
- Gemfile.lock
|
40
|
+
- LICENSE.txt
|
41
|
+
- README.md
|
42
|
+
- Rakefile
|
43
|
+
- bin/benchmark
|
44
|
+
- bin/console
|
45
|
+
- bin/setup
|
46
|
+
- bin/test_run
|
47
|
+
- ext/oj-introspect/extconf.rb
|
48
|
+
- ext/oj-introspect/introspect.c
|
49
|
+
- lib/oj/introspect.rb
|
50
|
+
- lib/oj/introspect/version.rb
|
51
|
+
- oj-introspect.gemspec
|
52
|
+
homepage: https://github.com/meinac/oj-introspect
|
53
|
+
licenses:
|
54
|
+
- MIT
|
55
|
+
metadata: {}
|
56
|
+
post_install_message:
|
57
|
+
rdoc_options: []
|
58
|
+
require_paths:
|
59
|
+
- lib
|
60
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: 2.3.0
|
65
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
requirements: []
|
71
|
+
rubygems_version: 3.1.6
|
72
|
+
signing_key:
|
73
|
+
specification_version: 4
|
74
|
+
summary: Oj introspect parser.
|
75
|
+
test_files: []
|