Module: Utilrb

Defined in:
lib/utilrb/common.rb,
lib/utilrb/pkgconfig.rb,
lib/utilrb/configsearch/configuration_finder.rb,
ext/utilrb_ext.cc

Defined Under Namespace

Classes: ConfigurationFinder, PkgConfig, WeakRef

Constant Summary collapse

VERSION =
"1.6.2"
RUBY_IS_19 =
(RUBY_VERSION >= "1.9.2")
RUBY_IS_191 =
(RUBY_VERSION >= "1.9") && (RUBY_VERSION < "1.9.2")
UTILRB_EXT_MODE =
nil

Class Method Summary collapse

Class Method Details

.if_ext(&block) ⇒ Object

Yields if the extension is present. This is used for Ruby code which depends on methods in the C extension



38
39
40
# File 'lib/utilrb/common.rb', line 38

def self.if_ext(&block)
	require_ext(nil, &block)
end

.require_ext(name) ⇒ Object

Yields if the extension is present, and issue a warning otherwise. This is used for Ruby code which depends on methods in the C extension



45
46
47
48
49
50
51
# File 'lib/utilrb/common.rb', line 45

def self.require_ext(name)
	if UTILRB_EXT_MODE
 yield if block_given?
	elsif name
 STDERR.puts "Utilrb: not loading #{name} since the C extension is not available"
	end
end

.unless_extObject

Yields if the extension is not present This is used by Utilrb libraries to provide a Ruby version if the C extension is not loaded



30
31
32
33
34
# File 'lib/utilrb/common.rb', line 30

def self.unless_ext # :yield:
	unless UTILRB_EXT_MODE
 return yield if block_given?
	end
end