• Stars
    star
    11
  • Rank 1,640,887 (Top 34 %)
  • Language
    Crystal
  • License
    MIT License
  • Created about 8 years ago
  • Updated about 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A crystal-lang tree structure that is built using a delimiter.

Delimiter Tree

A delimiter tree is a tree that is built from a string based on the delimiter. For example, if you have a string "foo;bar" then you will have a parent node "foo" and a child node "bar". Each node will hold a payload.

The delimiter tree also supports two special characters.

  • : is used for a parameter
    • is used to include a payload for all children nodes

The tree will return an array of payloads for all matching * as well as the specific payload for the final matching string.

Installation

Add this to your application's shard.yml:

dependencies:
  delimiter_tree:
    github: drujensen/delimiter_tree

Usage

The delimiter tree is used to return a payload or an array of payloads for a particular delimited string. This can be used for url paths or any situation where you need to specifically hold data per each segment of a delimited string.

require "delimiter_tree"

tree = Delimiter::Tree(Symbol).new("/")
tree.add "/*", :all_children
tree.add "/products", :products
tree.add "/products/:id", :specific_product

result = tree.find "/products/2"

puts result.payload
# [:all_children, :products]

puts result.params
# :id => 2

Contributing

  1. Fork it ( https://github.com/drujensen/delimiter_tree/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

More Repositories

1

fib

Performance Benchmark of top Github languages
Ruby
838
star
2

heart-disease

Predicting Heart Disease using SHAInet
Crystal
10
star
3

amber-auth-example

Example of how to perform authentication in an Amber App
Crystal
6
star
4

db_scaffold

Generate Amber scaffolding from database schema
Crystal
5
star
5

diabetes

Crystal SHAINet example using Pima Indians dataset for Diabetes
Crystal
5
star
6

h5cr

HDF5 library for Crystal
Crystal
4
star
7

actix-blog

Example Blog using Rust, Actix Web, HTMX, Mustache
Rust
4
star
8

riscv-ubuntu

Run RISC-V development environment using docker
Vim Script
4
star
9

riscv-fibonacci

Recursive Fibonacci Benchmark running on RISC-V
Ruby
4
star
10

embedXcode

DEPRECATED: Xcode 4 Template for Arduino, chipKIT, Wiring, Energia
C++
4
star
11

GerbToSCAD

Ability to create 3D printable PCB boards by converting a Gerber file to OpenSCAD.
Ruby
3
star
12

weight

example linear regression using SHAInet
Crystal
2
star
13

cats_dogs

Cats vs Dogs Kaggle competition using NeuraLegion's ShaiNet library
Crystal
2
star
14

adventure

Example server-side rendered web-based site using Python and FastAPI.
Python
2
star
15

kscli

Kafka Schema Register CLI
Rust
2
star
16

docker-crystal

provides a docker image for the crystal-language
2
star
17

titanic

Crystal SHAInet neural network for predicting survival on titanic. Kaggle competition
Crystal
2
star
18

blog-amethyst

Blog using Crystal and Amethyst
Crystal
2
star
19

ldsync

The Launch Darkly Sync Utility
Crystal
1
star
20

tui-engine

Text Based Game Ending
Crystal
1
star
21

jsonapi

JSONAPI support in Crystal
Crystal
1
star
22

evolvenet-crystal

simple neural network using evolutionary strategy
Crystal
1
star