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