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/routable.rb | |
parent | 0af35d7e30e373b885bfddb30b14718d72d75ab0 (diff) |
Use StrongMemoize and enable/disable cops properly
Diffstat (limited to 'app/models/concerns/routable.rb')
-rw-r--r-- | app/models/concerns/routable.rb | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/app/models/concerns/routable.rb b/app/models/concerns/routable.rb index 05ddae42d2d..efec55d7376 100644 --- a/app/models/concerns/routable.rb +++ b/app/models/concerns/routable.rb @@ -86,10 +86,9 @@ module Routable end end - # rubocop:disable Cop/ModuleWithInstanceVariables def full_name if route && route.name.present? - @full_name ||= route.name + @full_name ||= route.name # rubocop:disable Cop/ModuleWithInstanceVariables else update_route if persisted? @@ -113,7 +112,7 @@ module Routable def expires_full_path_cache RequestStore.delete(full_path_key) if RequestStore.active? - @full_path = nil + @full_path = nil # rubocop:disable Cop/ModuleWithInstanceVariables end def build_full_path @@ -126,10 +125,9 @@ module Routable private - # rubocop:disable Cop/ModuleWithInstanceVariables def uncached_full_path if route && route.path.present? - @full_path ||= route.path + @full_path ||= route.path # rubocop:disable Cop/ModuleWithInstanceVariables else update_route if persisted? @@ -164,12 +162,11 @@ module Routable route.save end - # rubocop:disable Cop/ModuleWithInstanceVariables def prepare_route route || build_route(source: self) route.path = build_full_path route.name = build_full_name - @full_path = nil - @full_name = nil + @full_path = nil # rubocop:disable Cop/ModuleWithInstanceVariables + @full_name = nil # rubocop:disable Cop/ModuleWithInstanceVariables end end |