Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kgrz/hashish
Adds a #to_hash method to a Class/Struct/OpenStruct that returns a hash based on the method values rather than instance variable values.
https://github.com/kgrz/hashish
Last synced: about 2 months ago
JSON representation
Adds a #to_hash method to a Class/Struct/OpenStruct that returns a hash based on the method values rather than instance variable values.
- Host: GitHub
- URL: https://github.com/kgrz/hashish
- Owner: kgrz
- License: mit
- Created: 2013-05-23T10:51:45.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-05-23T11:52:30.000Z (over 11 years ago)
- Last Synced: 2023-03-12T07:18:50.092Z (almost 2 years ago)
- Language: Ruby
- Size: 109 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Hashish
TODO: Write a gem description
## Installation
Add this line to your application's Gemfile:
gem 'hashish'
And then execute:
$ bundle
Or install it yourself as:
$ gem install hashish
## Usage
```ruby
class A
include Hashish
attr_reader :a, :b, :cdef initialize(a, b ,c)
@a, @b, @c = a, b, c
end
end
```
and you can do this:```ruby
a = A.new(1,2,3)
a.to_hash # => {:a => 1, :b => 2, :c => 3}
```## Contributing
1. Fork it
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 new Pull Request