mirror of https://github.com/KLayout/klayout.git
27 lines
431 B
Ruby
27 lines
431 B
Ruby
|
|
module Test
|
||
|
|
module Unit
|
||
|
|
class AttributeMatcher
|
||
|
|
def initialize(test)
|
||
|
|
@test = test
|
||
|
|
end
|
||
|
|
|
||
|
|
def match?(expression)
|
||
|
|
matched = instance_eval(expression)
|
||
|
|
if matched.nil?
|
||
|
|
false
|
||
|
|
else
|
||
|
|
matched
|
||
|
|
end
|
||
|
|
end
|
||
|
|
|
||
|
|
def method_missing(name, *args)
|
||
|
|
if args.empty?
|
||
|
|
@test[name]
|
||
|
|
else
|
||
|
|
super
|
||
|
|
end
|
||
|
|
end
|
||
|
|
end
|
||
|
|
end
|
||
|
|
end
|