Class: Gitlab::ChangesList
- Inherits:
-
Object
- Object
- Gitlab::ChangesList
- Includes:
- Enumerable
- Defined in:
- lib/gitlab/changes_list.rb
Instance Attribute Summary collapse
-
#raw_changes ⇒ Object
readonly
Returns the value of attribute raw_changes.
Instance Method Summary collapse
- #changes ⇒ Object
- #each(&block) ⇒ Object
-
#initialize(changes) ⇒ ChangesList
constructor
A new instance of ChangesList.
Constructor Details
#initialize(changes) ⇒ ChangesList
Returns a new instance of ChangesList.
9 10 11 |
# File 'lib/gitlab/changes_list.rb', line 9 def initialize(changes) @raw_changes = changes.is_a?(String) ? changes.lines : changes end |
Instance Attribute Details
#raw_changes ⇒ Object (readonly)
Returns the value of attribute raw_changes.
7 8 9 |
# File 'lib/gitlab/changes_list.rb', line 7 def raw_changes @raw_changes end |
Instance Method Details
#changes ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/gitlab/changes_list.rb', line 17 def changes @changes ||= @raw_changes.filter_map do |change| next if change.blank? oldrev, newrev, ref = change.strip.split(' ') { oldrev: oldrev, newrev: newrev, ref: ref } end end |
#each(&block) ⇒ Object
13 14 15 |
# File 'lib/gitlab/changes_list.rb', line 13 def each(&block) changes.each(&block) end |