Class: GObjectIntrospection::IRepository
- Inherits:
-
Object
- Object
- GObjectIntrospection::IRepository
- Includes:
- Singleton
- Defined in:
- lib/ffi-gobject_introspection/i_repository.rb
Overview
The Gobject Introspection Repository. This class is the point of access to the introspection typelibs. This class wraps the GIRepository struct.
Class Method Summary collapse
- .default ⇒ Object
- .prepend_search_path(path) ⇒ Object
- .type_tag_to_string(type) ⇒ Object
- .wrap_ibaseinfo_pointer(ptr) ⇒ Object
Instance Method Summary collapse
- #dependencies(namespace) ⇒ Object
- #find_by_gtype(gtype) ⇒ Object
- #find_by_name(namespace, name) ⇒ Object
- #info(namespace, index) ⇒ Object
-
#infos(namespace) ⇒ Object
Utility method.
-
#initialize ⇒ IRepository
constructor
A new instance of IRepository.
- #n_infos(namespace) ⇒ Object
- #require(namespace, version = nil, flags = 0) ⇒ Object
- #shared_library(namespace) ⇒ Object
- #to_ptr ⇒ Object
- #version(namespace) ⇒ Object
Constructor Details
#initialize ⇒ IRepository
Returns a new instance of IRepository.
14 15 16 |
# File 'lib/ffi-gobject_introspection/i_repository.rb', line 14 def initialize @pointer = Lib.g_irepository_get_default end |
Class Method Details
.default ⇒ Object
24 25 26 |
# File 'lib/ffi-gobject_introspection/i_repository.rb', line 24 def self.default instance end |
.prepend_search_path(path) ⇒ Object
28 29 30 |
# File 'lib/ffi-gobject_introspection/i_repository.rb', line 28 def self.prepend_search_path(path) Lib.g_irepository_prepend_search_path path end |
.type_tag_to_string(type) ⇒ Object
32 33 34 |
# File 'lib/ffi-gobject_introspection/i_repository.rb', line 32 def self.type_tag_to_string(type) Lib.g_type_tag_to_string type end |
Instance Method Details
#dependencies(namespace) ⇒ Object
73 74 75 76 77 |
# File 'lib/ffi-gobject_introspection/i_repository.rb', line 73 def dependencies(namespace) strv_p = Lib.g_irepository_get_dependencies(self, namespace) strv = Strv.new strv_p strv.to_a end |
#find_by_gtype(gtype) ⇒ Object
66 67 68 69 70 71 |
# File 'lib/ffi-gobject_introspection/i_repository.rb', line 66 def find_by_gtype(gtype) raise ArgumentError, "Type #{gtype} is not a valid type" if gtype == 0 @gtype_cache ||= {} @gtype_cache[gtype] ||= wrap_info Lib.g_irepository_find_by_gtype(self, gtype) end |
#find_by_name(namespace, name) ⇒ Object
60 61 62 63 64 |
# File 'lib/ffi-gobject_introspection/i_repository.rb', line 60 def find_by_name(namespace, name) @name_cache ||= {} @name_cache[[namespace, name]] ||= wrap_info Lib.g_irepository_find_by_name(self, namespace, name) end |
#info(namespace, index) ⇒ Object
49 50 51 |
# File 'lib/ffi-gobject_introspection/i_repository.rb', line 49 def info(namespace, index) wrap_info Lib.g_irepository_get_info(self, namespace, index) end |
#infos(namespace) ⇒ Object
Utility method
54 55 56 57 58 |
# File 'lib/ffi-gobject_introspection/i_repository.rb', line 54 def infos(namespace) (0..(n_infos(namespace) - 1)).map do |idx| info namespace, idx end end |
#n_infos(namespace) ⇒ Object
45 46 47 |
# File 'lib/ffi-gobject_introspection/i_repository.rb', line 45 def n_infos(namespace) Lib.g_irepository_get_n_infos self, namespace end |
#require(namespace, version = nil, flags = 0) ⇒ Object
36 37 38 39 40 41 42 43 |
# File 'lib/ffi-gobject_introspection/i_repository.rb', line 36 def require(namespace, version = nil, flags = 0) errpp = FFI::MemoryPointer.new(:pointer).write_pointer nil Lib.g_irepository_require self, namespace, version, flags, errpp errp = errpp.read_pointer raise GError.new(errp). unless errp.null? end |
#shared_library(namespace) ⇒ Object
79 80 81 |
# File 'lib/ffi-gobject_introspection/i_repository.rb', line 79 def shared_library(namespace) Lib.g_irepository_get_shared_library self, namespace end |
#to_ptr ⇒ Object
18 19 20 |
# File 'lib/ffi-gobject_introspection/i_repository.rb', line 18 def to_ptr @pointer end |
#version(namespace) ⇒ Object
83 84 85 |
# File 'lib/ffi-gobject_introspection/i_repository.rb', line 83 def version(namespace) Lib.g_irepository_get_version self, namespace end |