hacks 0.0.2 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/ext/hacks/hacks.c.erb +29 -0
  3. data/hacks.gemspec +1 -1
  4. metadata +6 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 16f90c56986bf11fcdd769d072e31c2e9a26e7f94279ed86bcf3b4f78363688c
4
- data.tar.gz: ab237d83bd1a90627c04f55f2751f8f6be9bc0ffe39c917cb25b1a4643b6712e
3
+ metadata.gz: f13cdcb072c1740305781547e1ec9fb8d325fc7f13c906b366ce5698457b8d0d
4
+ data.tar.gz: ce2d9afff0fad70ee8cf2e27f6cd2ba65fec40b610a45b0f145598f9cb9113ad
5
5
  SHA512:
6
- metadata.gz: eb63ecb06db50c6146cfb69328d60fbe1e74f24affd8ddf448c7158a09a9bd86ad078fd7a8360c0233105f0a16a060b38a129b4c16c3d98db0a4179a9efd5fca
7
- data.tar.gz: 05c35d336f2264c79304651d5e911589fbed8d960210a2480ecbd5ae6c27b7660a04cee55a214e8c862374db81a669641dafe3ebcf226ae83b9f03dcf0fd6144
6
+ metadata.gz: 88934330f21446db9a806ce0f65be1cd60361c18a1f38180c0c0425b20b6d34333771d1c3efb607921cebdef7fc652bb1b5fbaec6dc35fbb315cdf7be7c0701f
7
+ data.tar.gz: 4b335678b0e31af5018b4781d2057cb2193a6a66f179127ee8956e632a8b561a83255423e92f086bb7c856c5206335d12b42e0dfde19aee253e601d382f183cf
@@ -1,11 +1,36 @@
1
1
  #include <ruby.h>
2
2
 
3
+ static VALUE
4
+ hacks_rb_intern_str(VALUE mod, VALUE x)
5
+ {
6
+ return LONG2NUM(rb_intern_str(x));
7
+ }
8
+
9
+ static VALUE
10
+ hacks_rb_gc_writebarrier(VALUE mod, VALUE x, VALUE y)
11
+ {
12
+ rb_gc_writebarrier(x, y);
13
+ return Qtrue;
14
+ }
15
+
16
+ static VALUE
17
+ hacks_rb_obj_class(VALUE mod, VALUE x)
18
+ {
19
+ return rb_obj_class(x);
20
+ }
21
+
3
22
  static VALUE
4
23
  hacks_rb_type(VALUE mod, VALUE x)
5
24
  {
6
25
  return INT2NUM(rb_type(x));
7
26
  }
8
27
 
28
+ static VALUE
29
+ hacks_rb_id2sym(VALUE mod, VALUE x)
30
+ {
31
+ return rb_id2sym((ID)NUM2INT(x));
32
+ }
33
+
9
34
  void Init_hacks(void)
10
35
  {
11
36
  VALUE rb_mHacks = rb_define_module("Hacks");
@@ -31,4 +56,8 @@ void Init_hacks(void)
31
56
  rb_define_const(rb_mHacks, "STRUCTS", offsets);
32
57
 
33
58
  rb_define_singleton_method(rb_mHacks, "rb_type", hacks_rb_type, 1);
59
+ rb_define_singleton_method(rb_mHacks, "rb_id2sym", hacks_rb_id2sym, 1);
60
+ rb_define_singleton_method(rb_mHacks, "rb_obj_class", hacks_rb_obj_class, 1);
61
+ rb_define_singleton_method(rb_mHacks, "rb_gc_writebarrier", hacks_rb_gc_writebarrier, 2);
62
+ rb_define_singleton_method(rb_mHacks, "rb_intern_str", hacks_rb_intern_str, 1);
34
63
  }
data/hacks.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "hacks"
5
- s.version = "0.0.2"
5
+ s.version = "0.0.4"
6
6
  s.summary = "Ruby C internals exposed as Ruby"
7
7
  s.description = "These are some hacks I use. This gem exposes some Ruby C internals as Ruby functions and constants"
8
8
  s.authors = ["Aaron Patterson"]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hacks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Patterson
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-06 00:00:00.000000000 Z
11
+ date: 2023-04-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -60,7 +60,7 @@ homepage: https://github.com/tenderlove/hacks
60
60
  licenses:
61
61
  - Apache-2.0
62
62
  metadata: {}
63
- post_install_message:
63
+ post_install_message:
64
64
  rdoc_options: []
65
65
  require_paths:
66
66
  - lib
@@ -75,8 +75,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
75
75
  - !ruby/object:Gem::Version
76
76
  version: '0'
77
77
  requirements: []
78
- rubygems_version: 3.0.3.1
79
- signing_key:
78
+ rubygems_version: 3.5.0.dev
79
+ signing_key:
80
80
  specification_version: 4
81
81
  summary: Ruby C internals exposed as Ruby
82
82
  test_files: []