Class: Git::Blame::PorcelainEntry
- Inherits:
-
Object
- Object
- Git::Blame::PorcelainEntry
- Defined in:
- lib/Git/Blame.rb
Instance Attribute Summary collapse
-
#line_number ⇒ Object
readonly
class << self.
Class Method Summary collapse
Instance Method Summary collapse
- #code ⇒ Object
- #commit_hash ⇒ Object
-
#initialize(porcelain_output, line_number = nil) ⇒ PorcelainEntry
constructor
A new instance of PorcelainEntry.
- #parse ⇒ Object
- #previous_commit_hash ⇒ Object
Constructor Details
#initialize(porcelain_output, line_number = nil) ⇒ PorcelainEntry
Returns a new instance of PorcelainEntry.
42 43 44 45 |
# File 'lib/Git/Blame.rb', line 42 def initialize(porcelain_output, line_number = nil) @porcelain_output = porcelain_output @line_number = line_number end |
Instance Attribute Details
#line_number ⇒ Object (readonly)
class << self
40 41 42 |
# File 'lib/Git/Blame.rb', line 40 def line_number @line_number end |
Class Method Details
.parse(porcelain_output) ⇒ Object
34 35 36 |
# File 'lib/Git/Blame.rb', line 34 def parse(porcelain_output) new(porcelain_output).parse end |
Instance Method Details
#code ⇒ Object
65 66 67 |
# File 'lib/Git/Blame.rb', line 65 def code lines.last end |
#commit_hash ⇒ Object
57 58 59 |
# File 'lib/Git/Blame.rb', line 57 def commit_hash lines.first.split.first end |
#parse ⇒ Object
47 48 49 50 51 52 53 54 55 |
# File 'lib/Git/Blame.rb', line 47 def parse lines_with_keys.each do |line| variable_name = line.split.first.tr('-','_') value = line.split.all_but_first.join(' ') instance_variable_set("@#{variable_name}", value) self.class.class_eval("attr_reader :#{variable_name}") end self end |
#previous_commit_hash ⇒ Object
61 62 63 |
# File 'lib/Git/Blame.rb', line 61 def previous_commit_hash @previous.split.first end |