Class: Log
- Inherits:
-
Object
- Object
- Log
- Includes:
- Comparable
- Defined in:
- lib/forgetful-git/common/log.rb
Instance Attribute Summary collapse
-
#date ⇒ Object
readonly
Returns the value of attribute date.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#repo ⇒ Object
readonly
Returns the value of attribute repo.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
Class Method Summary collapse
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(log) ⇒ Log
constructor
A new instance of Log.
Constructor Details
#initialize(log) ⇒ Log
Returns a new instance of Log.
9 10 11 12 13 14 15 |
# File 'lib/forgetful-git/common/log.rb', line 9 def initialize(log) date, repo, = log.split("::") = date @date = DateTime.strptime(date,'%s').strftime("%Y-%m-%d %H:%M").to_s.yellow @repo = repo.green = end |
Instance Attribute Details
#date ⇒ Object (readonly)
Returns the value of attribute date.
7 8 9 |
# File 'lib/forgetful-git/common/log.rb', line 7 def date @date end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
7 8 9 |
# File 'lib/forgetful-git/common/log.rb', line 7 def end |
#repo ⇒ Object (readonly)
Returns the value of attribute repo.
7 8 9 |
# File 'lib/forgetful-git/common/log.rb', line 7 def repo @repo end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
7 8 9 |
# File 'lib/forgetful-git/common/log.rb', line 7 def end |
Class Method Details
.pretty_print(logs) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/forgetful-git/common/log.rb', line 21 def self.pretty_print(logs) logSubset = Log.sorted_subset(logs) longest = Log.longest(logSubset) logSubset.each do |log| printf("%s %-#{longest}s: %s\n", log.date, log.repo, log.) end end |
Instance Method Details
#<=>(other) ⇒ Object
17 18 19 |
# File 'lib/forgetful-git/common/log.rb', line 17 def <=>(other) other. <=> end |