reflection
Small library that provides macros in order to convert crystal expressions in you project into
a tree structure of Reflection::Node
s that can be inspected and used at runtime.
Installation
Add this to your application's shard.yml
:
dependencies:
reflection:
github: ragmaanir/reflection
Usage
require "reflection"
exp = Reflection.reflect_expression(4 + 5)
exp = exp.as(Reflection::Call)
assert exp.name == "+"
assert exp.receiver == Reflection::NumberLiteral.new(4)
assert exp.args[0] == Reflection::NumberLiteral.new(5)
Development
Contributing
- Fork it ( https://github.com/ragmaanir/reflection/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
- [ragmaanir] ragmaanir - creator, maintainer