Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/martimm/tinky-hash
https://github.com/martimm/tinky-hash
Last synced: 10 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/martimm/tinky-hash
- Owner: MARTIMM
- License: artistic-2.0
- Created: 2016-12-30T12:24:39.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2022-04-04T16:13:55.000Z (over 2 years ago)
- Last Synced: 2024-10-10T20:50:55.431Z (about 1 month ago)
- Language: Raku
- Size: 170 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Configuration refinements
[![Build Status](https://travis-ci.org/MARTIMM/config-datalang-refine.svg?branch=master)](https://travis-ci.org/MARTIMM/tinky-hash)
[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/MARTIMM/tinky-hash?branch=master&passingText=Windows%20-%20OK&failingText=Windows%20-%20FAIL&pendingText=Windows%20-%20pending&svg=true)](https://ci.appveyor.com/project/MARTIMM/tinky-hash/branch/master)
[![License](http://martimm.github.io/label/License-label.svg)](http://www.perlfoundation.org/artistic_license_2_0)# Synopsis
```
use Tinky::Hash;class MyStateEngine is Tinky::Hash {
submethod BUILD ( ) {
self.from-hash(
:config( {
:states([< a z q>]),
:transitions( {
:az( { :from, :to}),
:za( { :from, :to}),
:zq( { :from, :to}),
:qa( { :from, :to}),
}
),
:workflow( { :name, :initial-state}),
:taps( {
:states( { :q( { :enter})})
:transitions( { :zq}),
}
),
}
)
);
}method tr-zq ( $object, Tinky::Transition $trans, Str :$transit ) {
say "specific transition $transit '", $object.^name,
"' '$trans.from.name()' ===>> '$trans.to.name()'";
is $trans.from.name, 'z', "Comes from 'z'";
is $trans.to.name, 'q', "Goes to 'q'";
}method enter-q ( $object, Str :$state, EventType :$event) {
say "state enter event: enter q in ", $object.^name;
is $state, 'q', 'state is q';
is $event, Enter, 'event is Enter';
}
}my MyStateEngine $th .= new;
$th.workflow('wf4');
say $th.state.name; # 'a'
say $th.next-states>>.name; # ('z',)$th.go-state('z');
say $th.state.name; # 'z'
say $th.next-states>>.name; # ()# specific transition zq 'MyStateEngine' 'z' ===>> 'q'
# state enter event: enter q in MyStateEngine$th.go-state('q');
```
# Documentation
Please look also at the Tinky documentation of Jonathon Stowe and his story at
the perl6 advent calendar 18th december 2016 to understand the purpose of Tinky.
After that it will be easy to grasp the use of this module.* [Tinky](https://github.com/jonathanstowe/Tinky)
* [Perl6 advent calendar](https://perl6advent.wordpress.com/2016/12/18/)Documentation about this class and other information at
* [Tinky::Hash](https://github.com/MARTIMM/tinky-hash/blob/master/doc/Hash.pdf)
* [Release notes](https://github.com/MARTIMM/tinky-hash/blob/master/doc/CHANGES.md)
* [Todo and Bugs](https://github.com/MARTIMM/tinky-hash/blob/master/doc/TODO.md)# Author
```Marcel Timmerman: MARTIMM on github```