This commit is contained in:
Yessiest 2023-04-12 00:52:10 +04:00
parent d1fcac827d
commit ac2dd66f36
1 changed files with 23 additions and 5 deletions

28
hyde.rb
View File

@ -1,15 +1,33 @@
require 'webrick'
module Hyde module Hyde
class Pathspec class Servlet
def initialize (path, &block) def initialize (path, &block_optional)
@path = path.split "/" if path.kind_of? String
end
end
class Pathspec
def initialize (path, &block, root: nil)
@path = (path.split "/").filter {|x| x != ""} if path.kind_of? String
@path = [path] if path.kind_of? Regexp @path = [path] if path.kind_of? Regexp
@chain = [] @chain = []
@root_override = root
@remap = false
self.instance_eval &block self.instance_eval &block
end end
def path(*a, **b, &block) def path(*a, **b, &block)
@chain.append Hyde::Pathspec.new *a, **b, &block @chain.append Hyde::Pathspec.new *a, **b, &block
end end
def root(path)
@root_override = root
end
def remap(path)
@root_override = root
@remap = true
end
def match(path)
end
def match?(path)
end
end end
end end