jsonsl 0.1.0 → 0.1.1

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
  SHA256:
3
- metadata.gz: 64e6f5a1ee987b035efe8fcbdc6a3d4382b75cc8f3893d1f49d26815c2ec197c
4
- data.tar.gz: f4a426e7e6caef0d40a21246e0ad09c81f20cc9feeb395ab13ae566fb2b491d5
3
+ metadata.gz: 31d56076ec6092f8cf9024f9c100cb37acb0a9cc22700b7d907f478afbe462a4
4
+ data.tar.gz: fb5cdc81b227ffccd52ee3ffa320940c54c03996a9fa79efbfd1ce9e00e391c7
5
5
  SHA512:
6
- metadata.gz: aa87c23e4b39cb9fc6d9f4bb3dc1a59780c4abfd2f69b19cc943c0b855f04e6606a0f1ca6bfc690e3d516c230fa6d240661ba49a483583d395fb58a124314fff
7
- data.tar.gz: c17d0c7b48781b411f6fad0f8a691665dcd6eb62461b652e9c830ed8a1a0fea0ba1716cb4145932c389f63190f860ad5611566a9c7feb113fbab1f1057d25f9b
6
+ metadata.gz: '0593dad215bc868ddde6e24aa5c7cd108e68ef874c5b3b91a2a4d9599c5478e238004d63af34972b35a7f985a7563d9b06cc516e26fa987a73d0a767a64ede4b'
7
+ data.tar.gz: 134c6b06d16f19e3e64ca14d96365288854761672c2635290fba8fbd633f942ca6e1e58bc6eb6071e5616a96f496b389d5a3106755ea55c82134382277a13266
@@ -127,6 +127,9 @@ static void jsl_parser_row_pop_callback(jsonsl_t jsn, jsonsl_action_t action, st
127
127
  if (state->val == jsl_sym_rows) {
128
128
  jsn->action_callback_POP = jsl_parser_cover_pop_callback;
129
129
  jsn->action_callback_PUSH = NULL;
130
+ if (parser->rowcount == 0) {
131
+ parser->header_len = state->pos_begin + 1;
132
+ }
130
133
  return;
131
134
  }
132
135
 
@@ -135,7 +138,7 @@ static void jsl_parser_row_pop_callback(jsonsl_t jsn, jsonsl_action_t action, st
135
138
  if (state->type == JSONSL_T_SPECIAL) {
136
139
  len--;
137
140
  }
138
- rb_funcall(parser->proc, jsl_id_call, 2, INT2FIX(parser->rowcount), rb_str_new(ptr, len));
141
+ rb_funcall(parser->proc, jsl_id_call, 2, rb_str_new(ptr, len), INT2FIX(parser->rowcount));
139
142
  parser->rowcount++;
140
143
 
141
144
  (void)action;
@@ -245,12 +248,13 @@ static VALUE jsl_parser_inspect(VALUE self)
245
248
  static VALUE jsl_parser_feed(VALUE self, VALUE data)
246
249
  {
247
250
  jsl_PARSER *parser = DATA_PTR(self);
248
- size_t old_len = RSTRING_LEN(parser->buffer);
251
+ size_t old_len;
249
252
 
250
253
  if (NIL_P(parser->buffer)) {
251
- jsl_raise_msg("unable to feed completed parser");
254
+ return self;
252
255
  }
253
256
  Check_Type(data, T_STRING);
257
+ old_len = RSTRING_LEN(parser->buffer);
254
258
  rb_str_buf_append(parser->buffer, data);
255
259
  jsonsl_feed(parser->jsn, RSTRING_PTR(parser->buffer) + old_len, RSTRING_LEN(data));
256
260
 
@@ -15,5 +15,5 @@
15
15
  # limitations under the License.
16
16
 
17
17
  module JSONSL
18
- VERSION = '0.1.0'
18
+ VERSION = '0.1.1'
19
19
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsonsl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey Avseyev