Class: Gitlab::Diff::PositionCollection
- Inherits:
-
Object
- Object
- Gitlab::Diff::PositionCollection
- Includes:
- Enumerable
- Defined in:
- lib/gitlab/diff/position_collection.rb
Instance Method Summary collapse
- #concat(positions) ⇒ Object
- #each(&block) ⇒ Object
-
#initialize(collection, diff_head_sha = nil) ⇒ PositionCollection
constructor
collection - An array of Gitlab::Diff::Position.
-
#unfoldable ⇒ Object
Doing a lightweight filter in-memory given we’re not prepared for querying positions (gitlab.com/gitlab-org/gitlab/issues/33271).
Constructor Details
#initialize(collection, diff_head_sha = nil) ⇒ PositionCollection
collection - An array of Gitlab::Diff::Position
9 10 11 12 |
# File 'lib/gitlab/diff/position_collection.rb', line 9 def initialize(collection, diff_head_sha = nil) @collection = collection @diff_head_sha = diff_head_sha end |
Instance Method Details
#concat(positions) ⇒ Object
18 19 20 |
# File 'lib/gitlab/diff/position_collection.rb', line 18 def concat(positions) tap { @collection.concat(positions) } end |
#each(&block) ⇒ Object
14 15 16 |
# File 'lib/gitlab/diff/position_collection.rb', line 14 def each(&block) filtered_positions.each(&block) end |
#unfoldable ⇒ Object
Doing a lightweight filter in-memory given we’re not prepared for querying positions (gitlab.com/gitlab-org/gitlab/issues/33271).
24 25 26 27 28 |
# File 'lib/gitlab/diff/position_collection.rb', line 24 def unfoldable select do |position| position.unfoldable? && valid_head_sha?(position) end end |