Class: Appsignal::Extension::Data Private

Inherits:
Object
  • Object
show all
Defined in:
lib/appsignal/extension.rb,
ext/appsignal_extension.c

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Direct Known Subclasses

MockData

Instance Method Summary collapse

Instance Method Details

#==(other) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Data equality



540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
# File 'ext/appsignal_extension.c', line 540

static VALUE data_equal(VALUE self, VALUE other) {
  appsignal_data_t* data;
  appsignal_data_t* other_data;

  if (TYPE(other) != RUBY_T_DATA) {
    return Qfalse;
  }

  Data_Get_Struct(self, appsignal_data_t, data);
  Data_Get_Struct(other, appsignal_data_t, other_data);

  if (appsignal_data_equal(data, other_data) == 1) {
    return Qtrue;
  } else {
    return Qfalse;
  }
}

#append_boolean(value) ⇒ Object



500
501
502
503
504
505
506
507
508
509
510
511
# File 'ext/appsignal_extension.c', line 500

static VALUE data_append_boolean(VALUE self, VALUE value) {
  appsignal_data_t* data;

  Data_Get_Struct(self, appsignal_data_t, data);

  appsignal_data_array_append_boolean(
    data,
    RTEST(value)
 );

  return Qnil;
}

#append_data(value) ⇒ Object



523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
# File 'ext/appsignal_extension.c', line 523

static VALUE data_append_data(VALUE self, VALUE value) {
  appsignal_data_t* data;
  appsignal_data_t* value_data;

  Check_Type(value, RUBY_T_DATA);

  Data_Get_Struct(self, appsignal_data_t, data);
  Data_Get_Struct(value, appsignal_data_t, value_data);

  appsignal_data_array_append_data(
    data,
    value_data
  );

  return Qnil;
}

#append_float(value) ⇒ Object



485
486
487
488
489
490
491
492
493
494
495
496
497
498
# File 'ext/appsignal_extension.c', line 485

static VALUE data_append_float(VALUE self, VALUE value) {
  appsignal_data_t* data;

  Check_Type(value, T_FLOAT);

  Data_Get_Struct(self, appsignal_data_t, data);

  appsignal_data_array_append_float(
    data,
    NUM2DBL(value)
 );

  return Qnil;
}

#append_integer(value) ⇒ Object



467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
# File 'ext/appsignal_extension.c', line 467

static VALUE data_append_integer(VALUE self, VALUE value) {
  appsignal_data_t* data;
  VALUE value_type = TYPE(value);

  if (value_type != T_FIXNUM && value_type != T_BIGNUM) {
    rb_raise(rb_eTypeError, "wrong argument type %s (expected Integer)", rb_obj_classname(value));
  }

  Data_Get_Struct(self, appsignal_data_t, data);

  appsignal_data_array_append_integer(
    data,
    NUM2LONG(value)
 );

  return Qnil;
}

#append_nilObject



513
514
515
516
517
518
519
520
521
# File 'ext/appsignal_extension.c', line 513

static VALUE data_append_nil(VALUE self) {
  appsignal_data_t* data;

  Data_Get_Struct(self, appsignal_data_t, data);

  appsignal_data_array_append_null(data);

  return Qnil;
}

#append_string(value) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Add content to a data array



452
453
454
455
456
457
458
459
460
461
462
463
464
465
# File 'ext/appsignal_extension.c', line 452

static VALUE data_append_string(VALUE self, VALUE value) {
  appsignal_data_t* data;

  Check_Type(value, T_STRING);

  Data_Get_Struct(self, appsignal_data_t, data);

  appsignal_data_array_append_string(
    data,
    make_appsignal_string(value)
  );

  return Qnil;
}

#inspectObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



73
74
75
# File 'lib/appsignal/extension.rb', line 73

def inspect
  "#<#{self.class.name}:#{object_id} #{self}>"
end

#set_boolean(key, value) ⇒ Object



402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
# File 'ext/appsignal_extension.c', line 402

static VALUE data_set_boolean(VALUE self, VALUE key, VALUE value) {
  appsignal_data_t* data;

  Check_Type(key, T_STRING);

  Data_Get_Struct(self, appsignal_data_t, data);

  appsignal_data_map_set_boolean(
    data,
    make_appsignal_string(key),
    RTEST(value)
  );

  return Qnil;
}

#set_data(key, value) ⇒ Object



433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
# File 'ext/appsignal_extension.c', line 433

static VALUE data_set_data(VALUE self, VALUE key, VALUE value) {
  appsignal_data_t* data;
  appsignal_data_t* value_data;

  Check_Type(key, T_STRING);
  Check_Type(value, RUBY_T_DATA);

  Data_Get_Struct(self, appsignal_data_t, data);
  Data_Get_Struct(value, appsignal_data_t, value_data);

  appsignal_data_map_set_data(
    data,
    make_appsignal_string(key),
    value_data
  );

  return Qnil;
}

#set_float(key, value) ⇒ Object



385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
# File 'ext/appsignal_extension.c', line 385

static VALUE data_set_float(VALUE self, VALUE key, VALUE value) {
  appsignal_data_t* data;

  Check_Type(key, T_STRING);
  Check_Type(value, T_FLOAT);

  Data_Get_Struct(self, appsignal_data_t, data);

  appsignal_data_map_set_float(
    data,
    make_appsignal_string(key),
    NUM2DBL(value)
  );

  return Qnil;
}

#set_integer(key, value) ⇒ Object



365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
# File 'ext/appsignal_extension.c', line 365

static VALUE data_set_integer(VALUE self, VALUE key, VALUE value) {
  appsignal_data_t* data;
  VALUE value_type = TYPE(value);

  Check_Type(key, T_STRING);
  if (value_type != T_FIXNUM && value_type != T_BIGNUM) {
    rb_raise(rb_eTypeError, "wrong argument type %s (expected Integer)", rb_obj_classname(value));
  }

  Data_Get_Struct(self, appsignal_data_t, data);

  appsignal_data_map_set_integer(
    data,
    make_appsignal_string(key),
    NUM2LONG(value)
  );

  return Qnil;
}

#set_nil(key) ⇒ Object



418
419
420
421
422
423
424
425
426
427
428
429
430
431
# File 'ext/appsignal_extension.c', line 418

static VALUE data_set_nil(VALUE self, VALUE key) {
  appsignal_data_t* data;

  Check_Type(key, T_STRING);

  Data_Get_Struct(self, appsignal_data_t, data);

  appsignal_data_map_set_null(
    data,
    make_appsignal_string(key)
  );

  return Qnil;
}

#set_string(key, value) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Add content to a data map



348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
# File 'ext/appsignal_extension.c', line 348

static VALUE data_set_string(VALUE self, VALUE key, VALUE value) {
  appsignal_data_t* data;

  Check_Type(key, T_STRING);
  Check_Type(value, T_STRING);

  Data_Get_Struct(self, appsignal_data_t, data);

  appsignal_data_map_set_string(
    data,
    make_appsignal_string(key),
    make_appsignal_string(value)
  );

  return Qnil;
}

#to_sObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Get JSON content of a data



558
559
560
561
562
563
564
565
566
567
568
569
570
571
# File 'ext/appsignal_extension.c', line 558

static VALUE data_to_s(VALUE self) {
  appsignal_data_t* data;
  appsignal_string_t json;

  Data_Get_Struct(self, appsignal_data_t, data);

  json = appsignal_data_to_json(data);

  if (json.len == 0) {
    return Qnil;
  } else {
    return make_ruby_string(json);
  }
}