Sha256: b49bbd726b13cdc7c7ce7f9e8787f5c0ac2bbe1e91e3ab90c1c05a035af4e4b4

Contents?: true

Size: 686 Bytes

Versions: 3

Compression:

Stored size: 686 Bytes

Contents

# frozen_string_literal: true

require 'gir_ffi/method_setup'

module GirFFI
  # Base module for modules representing GLib namespaces.
  module ModuleBase
    include MethodSetup

    def method_missing(method, *arguments, &block)
      result = setup_method method.to_s
      return super unless result

      send method, *arguments, &block
    end

    def respond_to_missing?(method, *)
      gir_ffi_builder.method_available? method
    end

    def const_missing(classname)
      load_class(classname)
    end

    def load_class(classname)
      gir_ffi_builder.build_namespaced_class classname.to_s
    end

    def gir_ffi_builder
      self::GIR_FFI_BUILDER
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gir_ffi-0.14.1 lib/gir_ffi/module_base.rb
gir_ffi-0.14.0 lib/gir_ffi/module_base.rb
gir_ffi-0.13.1 lib/gir_ffi/module_base.rb