Fix X11 proxy constant lookup under 1.9+
This commit is contained in:
parent
3701081b65
commit
9561b4bc8e
@ -109,10 +109,19 @@ class X11Dependency < Requirement
|
||||
class Proxy < self
|
||||
PACKAGES = [:libpng, :freetype, :fontconfig]
|
||||
|
||||
def self.for(name, *tags)
|
||||
class << self
|
||||
def defines_const?(const)
|
||||
if ::RUBY_VERSION >= "1.9"
|
||||
const_defined?(const, false)
|
||||
else
|
||||
const_defined?(const)
|
||||
end
|
||||
end
|
||||
|
||||
def for(name, *tags)
|
||||
constant = name.capitalize
|
||||
|
||||
if const_defined?(constant)
|
||||
if defines_const?(constant)
|
||||
klass = const_get(constant)
|
||||
else
|
||||
klass = Class.new(self) do
|
||||
@ -124,6 +133,7 @@ class X11Dependency < Requirement
|
||||
klass.new(name, *tags)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user