diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2017-11-17 15:27:16 +0300 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2017-11-17 20:01:53 +0300 |
commit | 9ac0c76b78cd04b2505924f003dd720a0f155959 (patch) | |
tree | 67af1f0be0b9d6b5fc42b27c5afe5516e2c7574c /app/models/concerns/relative_positioning.rb | |
parent | 0af35d7e30e373b885bfddb30b14718d72d75ab0 (diff) |
Use StrongMemoize and enable/disable cops properly
Diffstat (limited to 'app/models/concerns/relative_positioning.rb')
-rw-r--r-- | app/models/concerns/relative_positioning.rb | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/app/models/concerns/relative_positioning.rb b/app/models/concerns/relative_positioning.rb index 9a7b9cd12b0..2ecce745ab9 100644 --- a/app/models/concerns/relative_positioning.rb +++ b/app/models/concerns/relative_positioning.rb @@ -44,7 +44,6 @@ module RelativePositioning next_pos end - # rubocop:disable Cop/ModuleWithInstanceVariables def move_between(before, after) return move_after(before) unless after return move_before(after) unless before @@ -53,13 +52,12 @@ module RelativePositioning # to its predecessor. This process will recursively move all the predecessors until we have a place if (after.relative_position - before.relative_position) < 2 before.move_before - @positionable_neighbours = [before] + @positionable_neighbours = [before] # rubocop:disable Cop/ModuleWithInstanceVariables end self.relative_position = position_between(before.relative_position, after.relative_position) end - # rubocop:disable Cop/ModuleWithInstanceVariables def move_after(before = self) pos_before = before.relative_position pos_after = before.next_relative_position @@ -67,7 +65,7 @@ module RelativePositioning if before.shift_after? issue_to_move = self.class.in_projects(project_ids).find_by!(relative_position: pos_after) issue_to_move.move_after - @positionable_neighbours = [issue_to_move] + @positionable_neighbours = [issue_to_move] # rubocop:disable Cop/ModuleWithInstanceVariables pos_after = issue_to_move.relative_position end @@ -75,7 +73,6 @@ module RelativePositioning self.relative_position = position_between(pos_before, pos_after) end - # rubocop:disable Cop/ModuleWithInstanceVariables def move_before(after = self) pos_after = after.relative_position pos_before = after.prev_relative_position @@ -83,7 +80,7 @@ module RelativePositioning if after.shift_before? issue_to_move = self.class.in_projects(project_ids).find_by!(relative_position: pos_before) issue_to_move.move_before - @positionable_neighbours = [issue_to_move] + @positionable_neighbours = [issue_to_move] # rubocop:disable Cop/ModuleWithInstanceVariables pos_before = issue_to_move.relative_position end @@ -144,4 +141,5 @@ module RelativePositioning status end + # rubocop:enable Cop/ModuleWithInstanceVariables end |