delegator
Version, currently 0.1.01 version
- 0.1.0latestOct 21, 2017
github.com/Schniz/delegator.cr
Decorates an object and delegates missing methods to it
1 stars
1 dependent
License: MIT
Installation
# Add this to your shard.yml
dependencies:
delegator:
github: Schniz/delegator.cr
version: ~> 0.1.0Then run:
shards installshard.yml
- Crystal
0.23.1- License
- MIT
- Author
- Gal Schlezinger <galstar@spitfire.co.il>
Dependencies
This version declares no dependencies.
README
# Delegator
Decorates an object and delegates missing methods to it.
[Based on the code in this gist](https://gist.github.com/decors/a1ba2b5e4a700235b0d993378836d7b4) by @decors
## Installation
Add this to your application's `shard.yml`:
```yaml
dependencies:
delegator:
github: Schniz/delegator.cr
```
## Usage
```crystal
require "delegator"
# Given a class
class Person
property name
def initialize(@name); end
end
# Create a subclass of Delegator
class PersonDelegator < Delegator(Person)
def greet
"Hello, #{name}!"
end
end
# Use it to decorate objects!
joe = Person.new("Joe")
PersonDelegator.delegate(joe).greet # "Hello Joe!"
```
## Contributing
1. Fork it ( https://github.com/Schniz/delegator/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
- [Schniz](https://github.com/Schniz) Gal Schlezinger - creator, maintainer
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.1.0- Tagged
- Oct 21, 2017
- Commit
55fc2229447d- Crystal
0.23.1- Indexed
- yes
Dependents
Repository
github.com/Schniz/delegator.cr
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 12, 2026
- Synced
- Aug 12, 2026
- Versions
- 1