Sha256: 0f1a666f22e949cdd1afa7ed58e45fdb4a66811184a069c6ba9b9f689ea7f06f
Contents?: true
Size: 711 Bytes
Versions: 5
Compression:
Stored size: 711 Bytes
Contents
module Aruba class Config attr_reader :hooks def initialize @hooks = Hooks.new end # Register a hook to be called before Aruba runs a command def before_cmd(&block) @hooks.append(:before_cmd, block) end end #nodoc class Hooks def initialize @store = Hash.new do |hash, key| hash[key] = [] end end def append(label, block) @store[label] << block end def execute(label, context, *args) @store[label].each do |block| context.instance_exec(*args, &block) end end end class << self attr_accessor :config def configure yield config end end self.config = Config.new end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
aruba-0.7.4 | lib/aruba/config.rb |
aruba-0.7.3 | lib/aruba/config.rb |
aruba-0.7.2 | lib/aruba/config.rb |
aruba-0.7.1 | lib/aruba/config.rb |
aruba-0.7.0 | lib/aruba/config.rb |