summaryrefslogtreecommitdiff
path: root/lib/dsl.rb
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-02-14 22:21:00 +0200
committerPaul Buetow <paul@buetow.org>2025-02-14 22:21:00 +0200
commitc7697dbd7d26bc6c62031e0d4d530b3b5987d9ee (patch)
tree232890d0ff7913b34982b53ca41b4b5ec5fde7b0 /lib/dsl.rb
parenta2edd9ec657dca835ce1a73807a86a9c44fdfec8 (diff)
more tests
Diffstat (limited to 'lib/dsl.rb')
-rw-r--r--lib/dsl.rb16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/dsl.rb b/lib/dsl.rb
index 1629afc..3a53762 100644
--- a/lib/dsl.rb
+++ b/lib/dsl.rb
@@ -10,15 +10,19 @@ module RCM
class DSL
attr_reader :id
- # TODO: Replace @@ with @ class variables
- @@rcm_counter = -1
- @@objs = {}
+ def self.reset!
+ @@rcm_counter = -1
+ @@objs = {}
+ end
+
+ reset!
include Config
include Options
include Log
- def initialize
+ def initialize(reset)
+ DSL.reset! if reset
@id = "#{self.class}(#{@@rcm_counter += 1})"
@conds_met = true
@scheduled = []
@@ -35,8 +39,8 @@ module RCM
end
end
-def configure(&block)
- RCM::DSL.new do |rcm|
+def configure(reset: false, &block)
+ RCM::DSL.new(reset) do |rcm|
rcm.info('Configuring...')
rcm.instance_eval(&block)
rcm.evaluate!