feat: 🔥 oh god

This commit is contained in:
David Bailey 2023-08-12 20:36:26 +02:00
parent cdb5492bfe
commit 3c7f48016d
30 changed files with 708 additions and 280 deletions

View file

@ -16,7 +16,7 @@ module Comfpile
end
def craft(stage, target, context)
context = @core.sanitize_context context
context = @core.get_context_key context
@recipes.each do |recipe|
match = target
@ -25,10 +25,10 @@ module Comfpile
next unless stage == recipe[:stage]
end
if r = recipe[:regex]
if not (r = recipe[:regex]).nil?
if r.is_a? String
next unless target == r
else
elsif r.is_a? Regexp
match = r.match target
next if match.nil?
end
@ -51,7 +51,7 @@ module Comfpile
other.subpriority <=> self.subpriority
end
def add_recipe(stage = nil, target_regex, &block)
def add_recipe(stage, target_regex = nil, &block)
@recipes << {
regex: target_regex,
stage: stage,