Class Grit::Status
In: lib/grit/status.rb
Parent: Object

Methods

[]   added   changed   deleted   each   new   pretty   untracked  

Included Modules

Enumerable

Classes and Modules

Class Grit::Status::StatusFile

Public Class methods

[Source]

    # File lib/grit/status.rb, line 9
 9:     def initialize(base)
10:       @base = base
11:       construct_status
12:     end

Public Instance methods

enumerable method

[Source]

    # File lib/grit/status.rb, line 47
47:     def [](file)
48:       @files[file]
49:     end

[Source]

    # File lib/grit/status.rb, line 18
18:     def added
19:       @files.select { |k, f| f.type == 'A' }
20:     end

[Source]

    # File lib/grit/status.rb, line 14
14:     def changed
15:       @files.select { |k, f| f.type == 'M' }
16:     end

[Source]

    # File lib/grit/status.rb, line 22
22:     def deleted
23:       @files.select { |k, f| f.type == 'D' }
24:     end

[Source]

    # File lib/grit/status.rb, line 51
51:     def each
52:       @files.each do |k, file|
53:         yield file
54:       end
55:     end

[Source]

    # File lib/grit/status.rb, line 30
30:     def pretty
31:       out = ''
32:       self.each do |file|
33:         out << file.path
34:         out << "\n\tsha(r) " + file.sha_repo.to_s + ' ' + file.mode_repo.to_s
35:         out << "\n\tsha(i) " + file.sha_index.to_s + ' ' + file.mode_index.to_s
36:         out << "\n\ttype   " + file.type.to_s
37:         out << "\n\tstage  " + file.stage.to_s
38:         out << "\n\tuntrac " + file.untracked.to_s
39:         out << "\n"
40:       end
41:       out << "\n"
42:       out
43:     end

[Source]

    # File lib/grit/status.rb, line 26
26:     def untracked
27:       @files.select { |k, f| f.untracked }
28:     end

[Validate]