summaryrefslogtreecommitdiff
path: root/lib/rcm.rb
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2024-12-06 23:50:13 +0200
committerPaul Buetow <paul@buetow.org>2024-12-06 23:50:13 +0200
commit36c00a4509e745e4b29b1194faca4dca830a9b95 (patch)
tree4f1a2c47db34ed38ea89c5631e01b5ea3c6b2e13 /lib/rcm.rb
parent7686fe830946ae36957501f1656bb429c694b09e (diff)
more on this
Diffstat (limited to 'lib/rcm.rb')
-rw-r--r--lib/rcm.rb11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/rcm.rb b/lib/rcm.rb
index d9880eb..1f45c39 100644
--- a/lib/rcm.rb
+++ b/lib/rcm.rb
@@ -4,6 +4,8 @@ Dir["#{Dir.pwd}/lib/autorequire/*.rb"].each { |m| require m }
module RCM
# Here all starts
class RCM
+ attr_reader :id
+
@@rcm_counter = 0
include Config
@@ -11,10 +13,10 @@ module RCM
include Log
def initialize
- @objs = []
+ @id = "#{self.class}(#{@@rcm_counter})"
+ @objs = {}
@conds_met = true
@@rcm_counter += 1
- @number = @@rcm_counter
end
def to_s
@@ -22,11 +24,12 @@ module RCM
end
def do!
- @objs.each(&:do!)
+ @objs.each_value(&:do!)
end
def <<(obj)
- @objs << obj
+ fatal_exit "Object #{obj.id} already declared!" if @objs.key?(obj.id)
+ @objs[obj.id] = obj
end
end
end