Module: Space::Source
Defined Under Namespace
Modules: ClassMethods
Classes: Command, Watch
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Events
events, notify, #notify, sources, subscribe, subscriptions
Instance Attribute Details
#path ⇒ Object
Returns the value of attribute path.
24
25
26
|
# File 'lib/space/source.rb', line 24
def path
@path
end
|
#results ⇒ Object
Returns the value of attribute results.
24
25
26
|
# File 'lib/space/source.rb', line 24
def results
@results
end
|
Class Method Details
.included(base) ⇒ Object
19
20
21
|
# File 'lib/space/source.rb', line 19
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
26
27
28
29
30
|
# File 'lib/space/source.rb', line 26
def initialize(path)
@path = path
@results = {}
watch
end
|
#refresh ⇒ Object
38
39
40
|
# File 'lib/space/source.rb', line 38
def refresh
commands.each { |key, command| command.refresh }
end
|
#update(key, result) ⇒ Object
42
43
44
45
|
# File 'lib/space/source.rb', line 42
def update(key, result)
results[key] = result
notify(:update)
end
|