meta
meta
This shard is based on a duscussion I had with @asterite (the retired creator of the Crystal programming language) in this forum thread.
Honestly, all the credit for this goes to him.
NOTICE: Not all helper methods will work in every situation, because I don't fully understand the code myself, I just copied it and made a few tweaks, so, it might not work perfectly.
Usage
method 1
- Add the dependency to your
shard.yml
:
dependencies:
meta:
github: crystal-china/meta
- require it directly.
require "meta"
There are many methods defined on Class/Object, check spec for usage.
method 2 (preferred)
There is another more convenient way to use meta.cr, you even don't need add meta into shard.yml
as dependency!
-
Copy file
meta.cr
to a local folder, e.g./home/foo/crystal/meta/meta.cr
-
Add following code to the file where you want those meta helper methods.
{{ read_file("/home/foo/crystal/meta/meta.cr").id }}
This use read_file macro to paste the content of meta.cr into the file where you want to use it.
method 3
You can add the folder where meta.cr
is located to CRYSTAL_PATH and require it.
Contributing
- Fork it (https://github.com/crystal-china/meta/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
- Ary Borenszweig
- Billy.Zheng vil963@gmail.com
meta
- 1
- 0
- 0
- 0
- 0
- 18 days ago
- June 3, 2025
MIT License
Sun, 22 Jun 2025 18:28:11 GMT