ActiveRegistry
Provides a data structure for collecting homogeneous objects and indexing them for quick lookup.
Requirements
Ruby 2.3+
Installation
Add this line to your application's Gemfile:
gem 'active_registry'
And then execute:
$ bundle
Or install it yourself as:
$ gem install active_registry
Usage
Person = Struct.new(:id, :name, :email)
registry = ActiveRegistry.new([
Person.new(1, 'Dale', '[email protected]'),
Person.new(2, 'Dale', '[email protected]')
])
registry.index(:name)
d = registry[:name, 'Dale'].first
d.name = "Jason"
registry.find(:name, 'Jason')
Development
After checking out the repo, run bundle
to install dependencies. Then, run bundle exec rspec
to run the tests.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/TwilightCoders/active_registry. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
License
The gem is available as open source under the terms of the MIT License.