class Shackleton::Route

Public Class Methods

new(name: nil, path: nil, parent: nil, **options, &block) click to toggle source
# File lib/shackleton/route.rb, line 8
def initialize(name: nil, path: nil, parent: nil, **options, &block)
  @name     = name
  @path     = path || name.to_s
  @options  = options
  @parent   = parent
  instance_exec self, &block if block_given?
end

Public Instance Methods

named_fragments() click to toggle source
# File lib/shackleton/route.rb, line 24
def named_fragments
  @named_fragments ||= pattern.names.map(&:to_sym)
end
route(name, path=nil, **options, &block) click to toggle source
# File lib/shackleton/route.rb, line 16
def route(name, path=nil, **options, &block)
  routes[name.to_sym] = self.class.new(name: name, path: path, **options, &block)
end
routes() click to toggle source
# File lib/shackleton/route.rb, line 20
def routes
  @routes ||= {}
end

Private Instance Methods

pattern() click to toggle source
# File lib/shackleton/route.rb, line 30
def pattern
  @pattern ||= Mustermann.new(@path, type: :rails)
end