Sha256: 79001f44ce1ffa7f6a9e3e953f0ed32c4ef860fdd55914da127835534da874fe

Contents?: true

Size: 394 Bytes

Versions: 20

Compression:

Stored size: 394 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
      if const_defined_for parent, name
        parent.const_get name
      else
        parent.const_set name, yield
      end
    end

  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
gir_ffi-0.5.1 lib/gir_ffi/builder_helper.rb
gir_ffi-0.5.0 lib/gir_ffi/builder_helper.rb
gir_ffi-0.4.3 lib/gir_ffi/builder_helper.rb
gir_ffi-0.4.2 lib/gir_ffi/builder_helper.rb
gir_ffi-0.4.1 lib/gir_ffi/builder_helper.rb
gir_ffi-0.4.0 lib/gir_ffi/builder_helper.rb
gir_ffi-0.3.2 lib/gir_ffi/builder_helper.rb
gir_ffi-0.3.1 lib/gir_ffi/builder_helper.rb
gir_ffi-0.3.0 lib/gir_ffi/builder_helper.rb
gir_ffi-0.2.3 lib/gir_ffi/builder_helper.rb
gir_ffi-0.2.2 lib/gir_ffi/builder_helper.rb
gir_ffi-0.2.1 lib/gir_ffi/builder_helper.rb
gir_ffi-0.2.0 lib/gir_ffi/builder_helper.rb
gir_ffi-0.1.0 lib/gir_ffi/builder_helper.rb
gir_ffi-0.0.14 lib/gir_ffi/builder_helper.rb
gir_ffi-0.0.13 lib/gir_ffi/builder_helper.rb
gir_ffi-0.0.12 lib/gir_ffi/builder_helper.rb
gir_ffi-0.0.11 lib/gir_ffi/builder_helper.rb
gir_ffi-0.0.10 lib/gir_ffi/builder_helper.rb
gir_ffi-0.0.9 lib/gir_ffi/builder_helper.rb