Class: RoutingFilter::SectionRoot

Inherits:
Filter
  • Object
show all
Extended by:
ActiveSupport::Memoizable
Defined in:
lib/adva/routing_filters/section_root.rb

Instance Method Summary collapse

Instance Method Details

#around_generate(params, &block) ⇒ Object



25
26
27
28
29
30
# File 'lib/adva/routing_filters/section_root.rb', line 25

def around_generate(params, &block)
  yield.tap do |path|
    # p "#{self.class.name}: #{path}"
    remove_root_section!(path) unless excluded?(path)
  end
end

#around_recognize(path, env, &block) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/adva/routing_filters/section_root.rb', line 16

def around_recognize(path, env, &block)
  # p "#{self.class.name}: #{path}"
  if !excluded?(path)
    search, replace = *recognition(host(env))
    path.sub!(search) { "#{$1}#{replace}#{$2}" } if search
  end
  yield
end