Sha256: 09aefebb4b7eac9e85a3c5e17045f4287a3784d807d4cb5597e82e57ed21277a
Contents?: true
Size: 999 Bytes
Versions: 2
Compression:
Stored size: 999 Bytes
Contents
module Space module Models class Repos include Events autoload :Collection, 'space/models/repos/collection' attr_accessor :project, :paths, :scope def initialize(project, paths) @project = project @paths = paths end def all @all ||= Collection.new(self, paths.map { |path| Repo.new(project, path) }) end def names @names ||= all.map(&:name) end def scope=(scope) @scope = scope notify(:update, nil) end def scope @scope || all end def scoped? !!@scope end def find_by_name(name) all.detect { |repo| repo.name == name } || raise("cannot find repo #{name.inspect}") end def select_by_names(names) Collection.new(self, all.select { |repo| names.include?(repo.name) }) end def subscribe(*args) super all.each { |repo| repo.subscribe(*args) } end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
space-0.0.5 | lib/space/models/repos.rb |
space-0.0.4 | lib/space/models/repos.rb |