Accessible Hash

Gem Version Build Status Code Climate Dependency Status

Description

Accessible Hash is a simple wrapper around the built-in Ruby Hash that behaves like a HashWithIndifferentAccess and also allows object.attribute style access.

Install

Manually:

gem install accessible-hash

or with Bundler (add to your Gemfile):

gem 'accessible-hash'

Usage

require 'accessible-hash'

foo = AccessibleHash.new(bar: 'baz')
foo['bar']  # => 'baz'
foo[:bar]   # => 'baz'
foo.bar     # => 'baz'