Cregularity v0.1.0
Cregularity
A Crystal port of andrewberls's Regularity gem for Ruby.
Installation
Add this to your application's shard.yml
:
dependencies:
cregularity:
github: spencerwi/cregularity
Usage
The API basically mirrors the Regularity gem, though you instantiate it as Cregularity.new
.
To borrow one of the original gem's examples:
require "cregularity"
re = Cregularity.new
.start_with(3, :digits)
.then("-")
.then(2, :letters)
.maybe("#")
.one_of(["a", "b"])
.between([2,4], "a")
.end_with("s")
if (re =~ "123-ff#baaas")
puts "It works!"
end
Development
To run tests:
$ crystal spec
Contributing
- Fork it (https://github.com/spencerwi/cregularity/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Contributors
- spencerwi - maintainer
- andrewberls - the developer of the original gem
Repository
Cregularity
Owner
Statistic
- 0
- 0
- 0
- 0
- 0
- about 6 years ago
- October 13, 2018
License
MIT License
Links
Synced at
Sun, 22 Dec 2024 08:27:35 GMT
Languages