Skip to content
Snippets Groups Projects
Commit 9561b4bc authored by Jack Nagel's avatar Jack Nagel
Browse files

Fix X11 proxy constant lookup under 1.9+

parent 3701081b
No related branches found
No related tags found
No related merge requests found
......@@ -109,19 +109,29 @@ class X11Dependency < Requirement
class Proxy < self
PACKAGES = [:libpng, :freetype, :fontconfig]
def self.for(name, *tags)
constant = name.capitalize
if const_defined?(constant)
klass = const_get(constant)
else
klass = Class.new(self) do
def initialize(name, *tags) super end
class << self
def defines_const?(const)
if ::RUBY_VERSION >= "1.9"
const_defined?(const, false)
else
const_defined?(const)
end
end
const_set(constant, klass)
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
klass.new(name, *tags)
end
end
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment