Project

rr3

0.0
No commit activity in last 3 years
No release in over 3 years
Ruby wrapper of r3 library.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.6
~> 10.0
>= 0
 Project Readme

Rr3

Dependency

OS X

brew install r3

Ubuntu PPA

The PPA for libr3 can be found in https://launchpad.net/~r3-team/+archive/libr3-daily

Installation

$ gem install rr3

Usage

require 'rr3'
@tree = Rr3::Tree.new(10)
@tree.insert_path "/bar"
@tree.insert_path "/zoo", 9527
@tree.insert_path "/foo/bar", 9527
@tree.insert_path "/post/{id}", 9527
@tree.insert_path "/user/{id:\\d+}", 9527
@tree.compile!
@tree.match "/user/xxx"  # => false # not matched
@tree.match "/asd"       # => false
@tree.match "/bar"       # => nil   # matched, and the route data is `nil`
@tree.match "/zoo"       # => 9527  # matched, and the route data is `9527`
@tree.match "/foo/bar"   # => 9527
@tree.match "/post/1234" # => 9527
@tree.match "/user/1234" # => 9527