Sha256: 93488f01a4dab1a1497ed10e257557f5044aa540fcd33014c956fe7d140e1925

Contents?: true

Size: 689 Bytes

Versions: 11

Compression:

Stored size: 689 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
        def pretty_print
          "#{@classname} = #{info.value.inspect}"
        end

        private

        def instantiate_class
          @klass = optionally_define_constant namespace_module, @classname do
            info.value
          end
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
gir_ffi-0.4.3 lib/gir_ffi/builder/type/constant.rb
gir_ffi-0.4.2 lib/gir_ffi/builder/type/constant.rb
gir_ffi-0.4.1 lib/gir_ffi/builder/type/constant.rb
gir_ffi-0.4.0 lib/gir_ffi/builder/type/constant.rb
gir_ffi-0.3.2 lib/gir_ffi/builder/type/constant.rb
gir_ffi-0.3.1 lib/gir_ffi/builder/type/constant.rb
gir_ffi-0.3.0 lib/gir_ffi/builder/type/constant.rb
gir_ffi-0.2.3 lib/gir_ffi/builder/type/constant.rb
gir_ffi-0.2.2 lib/gir_ffi/builder/type/constant.rb
gir_ffi-0.2.1 lib/gir_ffi/builder/type/constant.rb
gir_ffi-0.2.0 lib/gir_ffi/builder/type/constant.rb