alef 0.30.19

Opinionated polyglot binding generator for Rust libraries
Documentation
# frozen_string_literal: true

require_relative "{{ gem_name_snake }}/version"
require_relative "{{ gem_name_snake }}/native"

# Top-level namespace for the {{ module_name }} Ruby binding.
#
# All type and function symbols are re-exported from the native extension
# loaded via `require_relative "{{ gem_name_snake }}/native"`. See
# {file:README.md} for usage examples and the upstream documentation
# for the full API reference.
module {{ module_name }}
  # Re-export all types and functions from native extension
{% if has_services %}
  require_relative "{{ gem_name_snake }}/service"
{% endif %}
end

# Bring top-level {{ module_name }} classes into the global namespace so callers
# (and the generated e2e suite) can reference them unqualified. The native
# extension has already been required above, so every type constant is defined
# under {{ module_name }} by this point.
{{ module_name }}.constants.each do |const_name|
  value = {{ module_name }}.const_get(const_name)
  ::Object.const_set(const_name, value) if value.is_a?(Module) && !::Object.const_defined?(const_name)
end