Class: Space::Models::Project
- Inherits:
-
Object
- Object
- Space::Models::Project
- Includes:
- Events
- Defined in:
- lib/space/models/project.rb,
lib/space/models/project/bundler.rb
Defined Under Namespace
Classes: Bundler
Instance Attribute Summary collapse
-
#bundler ⇒ Object
readonly
Returns the value of attribute bundler.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#repos ⇒ Object
readonly
Returns the value of attribute repos.
Attributes included from Events
Instance Method Summary collapse
-
#initialize(name) ⇒ Project
constructor
A new instance of Project.
- #local_repos ⇒ Object
- #names ⇒ Object
- #number(name) ⇒ Object
- #refresh ⇒ Object
- #subscribe(*args) ⇒ Object
Methods included from Events
#buffering, #buffering?, #notify, #observers
Constructor Details
Instance Attribute Details
#bundler ⇒ Object (readonly)
Returns the value of attribute bundler.
8 9 10 |
# File 'lib/space/models/project.rb', line 8 def bundler @bundler end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
8 9 10 |
# File 'lib/space/models/project.rb', line 8 def config @config end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/space/models/project.rb', line 8 def name @name end |
#repos ⇒ Object (readonly)
Returns the value of attribute repos.
8 9 10 |
# File 'lib/space/models/project.rb', line 8 def repos @repos end |
Instance Method Details
#local_repos ⇒ Object
17 18 19 20 21 22 |
# File 'lib/space/models/project.rb', line 17 def local_repos bundler.config.keys.map do |key| key =~ /^local\.(.+)$/ $1 if repos.names.include?($1) end.compact end |
#names ⇒ Object
24 25 26 |
# File 'lib/space/models/project.rb', line 24 def names @names ||= Tmux.windows || repos.names end |
#number(name) ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/space/models/project.rb', line 28 def number(name) if number = names.index(name) number + 1 else names << name number(name) end end |
#refresh ⇒ Object
37 38 39 40 |
# File 'lib/space/models/project.rb', line 37 def refresh bundler.refresh repos.all.each(&:refresh) end |
#subscribe(*args) ⇒ Object
42 43 44 45 |
# File 'lib/space/models/project.rb', line 42 def subscribe(*args) super [bundler, repos].each { |object| object.subscribe(self) } end |