https://github.com/falm/rdecorator
yet another ruby decorator
https://github.com/falm/rdecorator
decorators ruby
Last synced: about 1 year ago
JSON representation
yet another ruby decorator
- Host: GitHub
- URL: https://github.com/falm/rdecorator
- Owner: falm
- License: mit
- Created: 2016-12-03T07:11:19.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-02-17T02:28:46.000Z (over 9 years ago)
- Last Synced: 2025-05-17T05:19:35.005Z (about 1 year ago)
- Topics: decorators, ruby
- Language: Ruby
- Homepage:
- Size: 17.6 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# RDecorator
[](https://travis-ci.org/falm/rdecorator) [](https://coveralls.io/github/falm/rdecorator?branch=master) [](https://gemnasium.com/github.com/falm/rdecorator) [](https://codeclimate.com/github/falm/rdecorator)
Rdecorator is an Pyhton like decorator use for AOP pattern programming
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'rdecorator'
```
And then execute:
$ bundle
## Usage
### Basic
```ruby
class Language
extend Rdecorator
def best(this, args)
'best Language' + this.call(args)
end
wrap :best
def ruby
'ruby'
end
end
Language.new.ruby #=> best Language ruby
```
### Decorator Class
```ruby
class Decorator
include Rdecorator
def call
'say fucking' + @this.call(*@args)
end
end
class DummyClass
decorator Decorator
def say(hello)
'hello'
end
end
```
## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/falm/rdecorator.