alef 0.25.37

Opinionated polyglot binding generator for Rust libraries
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# frozen_string_literal: true

require "json"
require "sorbet-runtime"
require "{{ ext_name }}"
{% if module_name != native_module_name %}
module {{ module_name }}
  # Re-export public types from the native extension (curated list, excludes Update/Builder types)
{% for type_name in public_types %}
  {{ type_name }} = {{ native_module_name }}.const_get(:{{ type_name }})
{% endfor %}
  # Re-export public module functions from the native extension (curated list)
{% for func_name in public_functions %}
  define_singleton_method(:{{ func_name }}) { |*args, **kwargs, &blk| {{ native_module_name }}.public_send(:{{ func_name }}, *args, **kwargs, &blk) }
{% endfor %}
end
{% endif %}