50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
# File 'lib/docman/commands/command.rb', line 50
def add_actions(obj, context = nil)
if obj.has_key? 'hooks' and obj['hooks'].has_key? @type and not obj['hooks'][@type].nil?
obj['hooks'][@type].each_pair do |name, hooks|
hooks = Marshal::load(Marshal.dump(hooks))
unless context.nil? or hooks.nil?
hooks.each do |hook|
hook['order'] = 0 unless hook['order']
hook['context'] = context
end
end
if @hooks[name].nil?
@hooks[name] = hooks
else
@hooks[name].concat(hooks)
end
end
end
end
|