class PkgConfig

Access to information from pkg-config(1)

Constants

ACTIONS

Attributes

name[R]

The module name

version[R]

The module version

Public Class Methods

new(name) click to toggle source

Create a PkgConfig object for the package name Raises PkgConfig::NotFound if the module does not exist

# File lib/autobuild/pkgconfig.rb, line 23
def initialize(name)
    unless system("pkg-config --exists #{name}")
        raise NotFound.new(name), "pkg-config package '#{name}' not found"
    end

    @name    = name
    @version = `pkg-config --modversion #{name}`.chomp.strip
    @actions = Hash.new
    @variables = Hash.new
end

Public Instance Methods

method_missing(varname, *args, &proc) click to toggle source
Calls superclass method
# File lib/autobuild/pkgconfig.rb, line 46
def method_missing(varname, *args, &proc)
    if args.empty?
        unless (value = @variables[varname])
            value = `pkg-config --variable=#{varname} #{name}`.chomp.strip
            @variables[varname] = value
        end
        return value
    end
    super
end
respond_to_missing?(varname, _include_all) click to toggle source
# File lib/autobuild/pkgconfig.rb, line 42
def respond_to_missing?(varname, _include_all)
    varname =~ /^\w+$/
end