Module: Space::Source
Defined Under Namespace
Modules: ClassMethods, Watcher
Classes: Command, Watch
Instance Attribute Summary collapse
Attributes included from Watcher
#path
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Events
events, flush, #notify, notify, sources, subscribe, subscriptions
Methods included from Watcher
#watched_paths
Instance Attribute Details
#results ⇒ Object
Returns the value of attribute results.
25
26
27
|
# File 'lib/space/source.rb', line 25
def results
@results
end
|
Class Method Details
.included(base) ⇒ Object
20
21
22
|
# File 'lib/space/source.rb', line 20
def included(base)
base.extend(ClassMethods)
end
|
Instance Method Details
#commands ⇒ Object
32
33
34
35
36
|
# File 'lib/space/source.rb', line 32
def commands
@commands ||= self.class.commands.inject({}) do |commands, (key, command)|
commands.merge(key => Command.new(self, key, command))
end
end
|
#initialize(path) ⇒ Object
27
28
29
30
|
# File 'lib/space/source.rb', line 27
def initialize(path)
@results = {}
super
end
|
#refresh ⇒ Object
42
43
44
|
# File 'lib/space/source.rb', line 42
def refresh
commands.each { |key, command| command.refresh }
end
|
#result(key) ⇒ Object
38
39
40
|
# File 'lib/space/source.rb', line 38
def result(key)
results[key] || ''
end
|
#update(key, result) ⇒ Object
46
47
48
49
|
# File 'lib/space/source.rb', line 46
def update(key, result)
results[key] = result
notify(:update)
end
|