def parse_child_patterns(&block)
context = Object.new
context.instance_eval do
def current=(value)
@current = value
end
def method_missing(method_name, *args, &block)
if method_name.to_s[0..0] == '_'
key = method_name.to_s[1..-1].to_sym
check_option(key)
args.each do |arg|
current_value = @current.options[key]
if current_value.nil?
@current.options[key] = arg
else
@current.options[key] = [current_value] if !current_value.is_a Array
@current.options[key] << arg
end
end
else
child = Scrubyt::Pattern.new(method_name.to_s, args, @current.extractor, @current, &block)
@current.children << child
child
end
end
end
context.current = self
context.instance_eval(&block)
end