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