Sha256: 491b62e4294202f85b6e267a71466cd0d93c42a06395a27ae2638c61c30354e4
Contents?: true
Size: 1015 Bytes
Versions: 1
Compression:
Stored size: 1015 Bytes
Contents
module Space module Source autoload :Command, 'space/source/command' autoload :Watch, 'space/source/watch' autoload :Watcher, 'space/source/watcher' module ClassMethods def commands(commands = nil) commands ? @commands = commands : @commands end def watch(*paths) paths.empty? ? (@paths || []) : (@paths = paths) end end include Events, Watcher class << self def included(base) base.extend(ClassMethods) end end attr_reader :results def initialize(path) @results = {} super end def commands @commands ||= self.class.commands.inject({}) do |commands, (key, command)| commands.merge(key => Command.new(self, key, command)) end end def result(key) results[key] || '' end def refresh commands.each { |key, command| command.refresh } end def update(key, result) results[key] = result notify(:update) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
space-0.0.6 | lib/space/source.rb |