Sha256: 68f97d00fb968fd82fd51961849123efb93941d472c866c51a37bd733ddbe176

Contents?: true

Size: 378 Bytes

Versions: 5

Compression:

Stored size: 378 Bytes

Contents

module GirFFI
  module BuilderHelper
    def const_defined_for parent, name
      if RUBY_VERSION < "1.9"
	parent.const_defined? name
      else
	parent.const_defined? name, false
      end
    end

    def optionally_define_constant parent, name
      unless const_defined_for parent, name
	parent.const_set name, yield
      end
      parent.const_get name
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
gir_ffi-0.0.8 lib/gir_ffi/builder_helper.rb
gir_ffi-0.0.7 lib/gir_ffi/builder_helper.rb
gir_ffi-0.0.6 lib/gir_ffi/builder_helper.rb
gir_ffi-0.0.5 lib/gir_ffi/builder_helper.rb
gir_ffi-0.0.4 lib/gir_ffi/builder_helper.rb