https://github.com/tilfin/neohash
Accessible Hash pseudo Struct and attaching it to an Object
https://github.com/tilfin/neohash
gem hash ruby
Last synced: about 1 year ago
JSON representation
Accessible Hash pseudo Struct and attaching it to an Object
- Host: GitHub
- URL: https://github.com/tilfin/neohash
- Owner: tilfin
- License: mit
- Created: 2018-02-12T17:00:50.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-03-17T07:05:16.000Z (over 8 years ago)
- Last Synced: 2024-04-25T02:42:40.826Z (about 2 years ago)
- Topics: gem, hash, ruby
- Language: Ruby
- Homepage:
- Size: 11.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# NeoHash
[](https://badge.fury.io/rb/neohash)
[](https://travis-ci.org/tilfin/neohash)
[](https://codeclimate.com/github/tilfin/neohash)
[](https://codeclimate.com/github/tilfin/neohash/coverage)
Accessible Hash and attaching it to an Object
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'neohash'
```
And then execute:
$ bundle
Or install it yourself as:
$ gem install neohash
## Usage
```ruby
class DynamicObject
include NeoHash::Support
def initialize(hash)
set_inner_hash(hash)
end
end
obj = DynamicObject.new({ port: 80, "host" => "localhost" })
p obj.port # 80
p obj[:host] # "localhost"
obj[:host] = "192.168.1.1"
p obj.host # "192.168.1.1"
```
## License
[MIT](LICENSE)