Module: Maglev::Page::PathConcern

Extended by:
ActiveSupport::Concern
Included in:
Maglev::Page
Defined in:
app/models/maglev/page/path_concern.rb

Overview

rubocop:disable Style/ClassAndModuleChildren

Instance Method Summary collapse

Instance Method Details

#current_pathObject



33
34
35
36
37
# File 'app/models/maglev/page/path_concern.rb', line 33

def current_path
  locale = Maglev::I18n.current_locale.to_sym
  @memoized_paths ||= {}
  @memoized_paths[locale] ||= paths.canonical.find_or_initialize_by(locale: locale, canonical: true)
end

#default_pathObject



21
22
23
# File 'app/models/maglev/page/path_concern.rb', line 21

def default_path
  @default_path ||= paths.find_by(locale: Maglev::I18n.default_locale)&.value
end

#disable_spawn_redirectionObject



43
44
45
# File 'app/models/maglev/page/path_concern.rb', line 43

def disable_spawn_redirection
  @disable_spawn_redirection = true
end

#pathObject



25
26
27
# File 'app/models/maglev/page/path_concern.rb', line 25

def path
  current_path.value
end

#path=(value) ⇒ Object



29
30
31
# File 'app/models/maglev/page/path_concern.rb', line 29

def path=(value)
  current_path.value = value
end

#path_hashObject



39
40
41
# File 'app/models/maglev/page/path_concern.rb', line 39

def path_hash
  paths.build_hash
end

#spawn_redirection_disabled?Boolean

Returns:

  • (Boolean)


47
48
49
# File 'app/models/maglev/page/path_concern.rb', line 47

def spawn_redirection_disabled?
  !!@disable_spawn_redirection
end