Sha256: ef3e4aa84a9c21b4cf53ecdf04c02a210eb3eb5f22e1d712bedc06d8f95363f8
Contents?: true
Size: 690 Bytes
Versions: 3
Compression:
Stored size: 690 Bytes
Contents
require 'mustermann/ast/pattern' module Mustermann # Sinatra 2.0 style pattern implementation. # # @example # Mustermann.new('/:foo') === '/bar' # => true # # @see Mustermann::Pattern # @see file:README.md#sinatra Syntax description in the README class Sinatra < AST::Pattern on(nil, ??, ?)) { |c| unexpected(c) } on(?*) { |c| scan(/\w+/) ? node(:named_splat, buffer.matched) : node(:splat) } on(?() { |c| node(:group) { read unless scan(?)) } } on(?:) { |c| node(:capture) { scan(/\w+/) } } on(?\\) { |c| node(:char, expect(/./)) } suffix ?? do |char, element| node(:optional, element) end end end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
mustermann19-0.3.1 | lib/mustermann/sinatra.rb |
mustermann-0.3.1 | lib/mustermann/sinatra.rb |
mustermann-0.3.0 | lib/mustermann/sinatra.rb |