Sha256: d6834e818d41565b864674c0d1c887c89e9d119041dfe69e086b4fb41e2914ab
Contents?: true
Size: 967 Bytes
Versions: 5
Compression:
Stored size: 967 Bytes
Contents
require 'gir_ffi/builder/type/base' module GirFFI module Builder module Type # Implements the creation of a constant. Though semantically not a # type, its build method is like that of the types, in that it is # triggered by a missing constant in the parent namespace. The # constant will be attached to the appropriate namespace module. class Constant < Base TYPE_TAG_TO_UNION_MEMBER = { :gint32 => :v_int32, :gdouble => :v_double, :utf8 => :v_string } private def instantiate_class @klass = optionally_define_constant namespace_module, @classname do tag = info.constant_type.tag val = info.value[TYPE_TAG_TO_UNION_MEMBER[tag]] if RUBY_VERSION >= "1.9" and tag == :utf8 val.force_encoding("utf-8") else val end end end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems