lib/sup/hook.rb in sup-0.6 vs lib/sup/hook.rb in sup-0.7
- old
+ new
@@ -50,10 +50,18 @@
print q
gets.chomp.downcase == 'y'
end
end
+ def get tag
+ HookManager.tags[tag]
+ end
+
+ def set tag, value
+ HookManager.tags[tag] = value
+ end
+
def __binding
binding
end
def __cleanup
@@ -66,14 +74,17 @@
def initialize dir
@dir = dir
@hooks = {}
@descs = {}
@contexts = {}
-
+ @tags = {}
+
Dir.mkdir dir unless File.exists? dir
self.class.i_am_the_instance self
end
+
+ attr_reader :tags
def run name, locals={}
hook = hook_for(name) or return
context = @contexts[hook] ||= HookContext.new(name)
context.__locals = locals