Class: Git::Status
- Inherits:
-
Object
- Object
- Git::Status
- Includes:
- Enumerable
- Defined in:
- lib/git/status.rb
Defined Under Namespace
Classes: StatusFile
Instance Method Summary (collapse)
-
- (Object) [](file)
enumerable method.
- - (Object) added
- - (Object) changed
- - (Object) deleted
- - (Object) each(&block)
-
- (Status) initialize(base)
constructor
A new instance of Status.
- - (Object) pretty
- - (Object) untracked
Constructor Details
- (Status) initialize(base)
A new instance of Status
6 7 8 9 |
# File 'lib/git/status.rb', line 6 def initialize(base) @base = base construct_status end |
Instance Method Details
- (Object) [](file)
enumerable method
44 45 46 |
# File 'lib/git/status.rb', line 44 def [](file) @files[file] end |
- (Object) added
15 16 17 |
# File 'lib/git/status.rb', line 15 def added @files.select { |k, f| f.type == 'A' } end |
- (Object) changed
11 12 13 |
# File 'lib/git/status.rb', line 11 def changed @files.select { |k, f| f.type == 'M' } end |
- (Object) deleted
19 20 21 |
# File 'lib/git/status.rb', line 19 def deleted @files.select { |k, f| f.type == 'D' } end |
- (Object) each(&block)
48 49 50 |
# File 'lib/git/status.rb', line 48 def each(&block) @files.values.each(&block) end |
- (Object) pretty
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/git/status.rb', line 27 def pretty out = '' self.each do |file| out << file.path out << "\n\tsha(r) " + file.sha_repo.to_s + ' ' + file.mode_repo.to_s out << "\n\tsha(i) " + file.sha_index.to_s + ' ' + file.mode_index.to_s out << "\n\ttype " + file.type.to_s out << "\n\tstage " + file.stage.to_s out << "\n\tuntrac " + file.untracked.to_s out << "\n" end out << "\n" out end |
- (Object) untracked
23 24 25 |
# File 'lib/git/status.rb', line 23 def untracked @files.select { |k, f| f.untracked } end |