Class: CommitHistoryContext
- Inherits:
-
Object
- Object
- CommitHistoryContext
- Defined in:
- lib/tipster/history/commit_history_context.rb
Instance Attribute Summary collapse
-
#change_list ⇒ Object
readonly
Returns the value of attribute change_list.
Instance Method Summary collapse
- #affected_files(output) ⇒ Object
- #build_change_list(changed_files) ⇒ Object
- #commit_history(line) ⇒ Object
-
#initialize(raw_output) ⇒ CommitHistoryContext
constructor
A new instance of CommitHistoryContext.
Constructor Details
#initialize(raw_output) ⇒ CommitHistoryContext
Returns a new instance of CommitHistoryContext.
7 8 9 |
# File 'lib/tipster/history/commit_history_context.rb', line 7 def initialize(raw_output) build_change_list(affected_files(raw_output)) end |
Instance Attribute Details
#change_list ⇒ Object (readonly)
Returns the value of attribute change_list.
5 6 7 |
# File 'lib/tipster/history/commit_history_context.rb', line 5 def change_list @change_list end |
Instance Method Details
#affected_files(output) ⇒ Object
11 12 13 |
# File 'lib/tipster/history/commit_history_context.rb', line 11 def affected_files(output) output.scan(/^\d.*$/) end |
#build_change_list(changed_files) ⇒ Object
15 16 17 18 |
# File 'lib/tipster/history/commit_history_context.rb', line 15 def build_change_list(changed_files) @change_list = [] changed_files.each { |file| @change_list << commit_history(file) } end |
#commit_history(line) ⇒ Object
20 21 22 |
# File 'lib/tipster/history/commit_history_context.rb', line 20 def commit_history(line) CommitHistory.new(line.split[0].to_i, line.split[1].to_i, line.split[2]) end |