Class: Hglib::Repo::StatusEntry
- Inherits:
-
Object
- Object
- Hglib::Repo::StatusEntry
- Extended by:
- Loggability
- Defined in:
- lib/hglib/repo/status_entry.rb
Overview
An entry in a repository’s status list.
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Return the Pathname of the file the status applies to.
-
#source ⇒ Object
readonly
The Pathname of the file the status applies to was copied from (if the status is ‘A`/`added`) and the addition was via a copy/move operation.
-
#status ⇒ Object
readonly
Return the character that denotes the file’s status.
Instance Method Summary collapse
-
#initialize(entryhash) ⇒ StatusEntry
constructor
Create a new log entry from the raw
entryhash. -
#inspect ⇒ Object
Return a human-readable representation of the StatusEntry as a String.
-
#status_description ⇒ Object
Return the human-readable status.
Constructor Details
#initialize(entryhash) ⇒ StatusEntry
Create a new log entry from the raw entryhash.
24 25 26 27 28 |
# File 'lib/hglib/repo/status_entry.rb', line 24 def initialize( entryhash ) @path = Pathname( entryhash[:path] ) @source = Pathname( entryhash[:source] ) if entryhash.key?( :source ) @status = entryhash[ :status ] end |
Instance Attribute Details
#path ⇒ Object (readonly)
Return the Pathname of the file the status applies to
37 38 39 |
# File 'lib/hglib/repo/status_entry.rb', line 37 def path @path end |
#source ⇒ Object (readonly)
The Pathname of the file the status applies to was copied from (if the status is ‘A`/`added`) and the addition was via a copy/move operation.
42 43 44 |
# File 'lib/hglib/repo/status_entry.rb', line 42 def source @source end |
#status ⇒ Object (readonly)
Return the character that denotes the file’s status
46 47 48 |
# File 'lib/hglib/repo/status_entry.rb', line 46 def status @status end |
Instance Method Details
#inspect ⇒ Object
Return a human-readable representation of the StatusEntry as a String.
66 67 68 69 70 71 72 73 74 |
# File 'lib/hglib/repo/status_entry.rb', line 66 def inspect return "#<%p:#%x %s: %s%s>" % [ self.class, self.object_id * 2, self.path, self.status_description, self.source ? " via copy/move from #{self.source}" : '', ] end |
#status_description ⇒ Object
Return the human-readable status.
50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/hglib/repo/status_entry.rb', line 50 def status_description return case self.status when 'M' then 'modified' when 'A' then 'added' when 'R' then 'removed' when 'C' then 'clean' when '!' then 'missing' when '?' then 'not tracked' when 'I' then 'ignored' else raise "unknown status %p" % [ self.status ] end end |