Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/joker1007/refining
Syntax Sugar of inline refinement module
https://github.com/joker1007/refining
Last synced: 2 days ago
JSON representation
Syntax Sugar of inline refinement module
- Host: GitHub
- URL: https://github.com/joker1007/refining
- Owner: joker1007
- License: mit
- Created: 2014-06-12T15:15:59.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-01-20T05:18:40.000Z (almost 10 years ago)
- Last Synced: 2024-04-15T22:38:42.492Z (7 months ago)
- Language: Ruby
- Homepage:
- Size: 146 KB
- Stars: 4
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Refining
This gem defines `Class#refining`.
`Class#refining` is helper of defining refinement module at inner class.
### before
```ruby
class User
module AdministratorRoll
refine User do
def delete_post(name)
"Delete: #{name}"
end
end
end
endclass DeletePostContext
using User::AdministratorRolldef execute
user = User.new
user.delete_post
end
end
```### after
```ruby
require 'refining'class User
refining :AdministratorRoll do
def delete_post(name)
"Delete: #{name}"
end
end
endclass DeletePostContext
using User::AdministratorRolldef execute
user = User.new
user.delete_post
end
end
```## Installation
Add this line to your application's Gemfile:
gem 'refining'
And then execute:
$ bundle
Or install it yourself as:
$ gem install refining
## Contributing
1. Fork it ( https://github.com/joker1007/refining/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