rj_schema 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6411c4f4d8aac88113af4355c41c5e7bfa54b015c3b57bf7ba61febe6b534648
4
- data.tar.gz: 231a52b016e6325ae1140f4ff18bb727ee7b05d4f3ac23cbf4015e391d4b59a4
3
+ metadata.gz: a1a69f6b3d192c21c9ec108ddac23ab6a7d5360ffc50be83414a5ed751216e47
4
+ data.tar.gz: 939bd3f2fc82b77df0c35f11d7e9345782875d909e38f042ffe7a9c8d8426d65
5
5
  SHA512:
6
- metadata.gz: 2bcb7da09863adda3dea6962112a4d236907227bfe4d0b5d51c24250963ef0363f2ff41ce62b6703d97656033158d72a1a3238f1e0a229ecd88dc6183a899293
7
- data.tar.gz: 99b5a2bc9ee639cd38e4cd2b93bee294e294df492f4323849bc4953bb6e8f8e34464cb135d7ccb3278bd97cf08b84c7d6d7cb68c682970f77583307998d669ef
6
+ metadata.gz: 1607700248a092bd5dcce95a4966f2d761eede35403e8178b0166df15507ff35a29932c2e1b03e41fe12c4e0c46b71fca8237330a89e72274c8db3d16425fa29
7
+ data.tar.gz: 63d7e7300d82bf026736496e45c0066c95fe73e9d6ee1f48f323c4f19693860f19a6963dc66c3669ecaccfae83f60a64d86e2a875b83342eb566a01c0d945d22
@@ -18,7 +18,7 @@
18
18
  #include <rapidjson/filereadstream.h>
19
19
  #include <rapidjson/prettywriter.h>
20
20
 
21
- typedef std::unordered_map<std::string, rapidjson::SchemaDocument> SchemaCollection;
21
+ typedef std::unordered_map<ID, rapidjson::SchemaDocument> SchemaCollection;
22
22
 
23
23
  class SchemaDocumentProvider : public rapidjson::IRemoteSchemaDocumentProvider {
24
24
  SchemaCollection* schema_collection;
@@ -26,7 +26,7 @@ class SchemaDocumentProvider : public rapidjson::IRemoteSchemaDocumentProvider {
26
26
  public:
27
27
  SchemaDocumentProvider(SchemaCollection* schema_collection) : schema_collection(schema_collection) { }
28
28
  virtual const rapidjson::SchemaDocument* GetRemoteDocument(const char* uri, rapidjson::SizeType length) {
29
- auto it = schema_collection->find(std::string(uri, length));
29
+ auto it = schema_collection->find(rb_intern2(uri, length));
30
30
  if (it == schema_collection->end())
31
31
  throw std::invalid_argument(std::string("$ref remote schema not provided: ") + uri);
32
32
  return &it->second;
@@ -79,10 +79,7 @@ VALUE perform_validation(VALUE self, VALUE schema_arg, VALUE document_arg, bool
79
79
  };
80
80
 
81
81
  if (SYMBOL_P(schema_arg)) {
82
- schema_arg = rb_funcall(schema_arg, rb_intern("to_s"), 0);
83
- auto it = schema_manager->collection.find(
84
- std::string(StringValuePtr(schema_arg), RSTRING_LEN(schema_arg))
85
- );
82
+ auto it = schema_manager->collection.find(SYM2ID(schema_arg));
86
83
  if (it == schema_manager->collection.end())
87
84
  rb_raise(rb_eArgError, "schema not found");
88
85
  return validate(it->second);
@@ -124,7 +121,7 @@ extern "C" int validator_initialize_load_schema(VALUE key, VALUE value, VALUE in
124
121
 
125
122
  try {
126
123
  schema_manager->collection.emplace(
127
- std::string(StringValuePtr(key), RSTRING_LEN(key)),
124
+ rb_to_id(key),
128
125
  rapidjson::SchemaDocument(
129
126
  parse_document(value),
130
127
  StringValuePtr(key),
@@ -1,7 +1,7 @@
1
1
  require 'json'
2
2
 
3
3
  class RjSchema
4
- VERSION = '0.1.1'
4
+ VERSION = '0.1.2'
5
5
  end
6
6
 
7
7
  require 'rj_schema/rj_schema'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rj_schema
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Semmler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-24 00:00:00.000000000 Z
11
+ date: 2018-02-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler