Project

triad

0.0
Low commit activity in last 3 years
No release in over a year
Triad allows you to access data from keys, descriptors, and values
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

Triad

Code Climate Coverage Status Gem Version

A Triad is like a Set, or a collection of three-part arrays.

A Triad is a collection of items each with a key, descriptor, and value.

Each key must be a unique symbol. Each descriptor must be a string. Each value must not be a symbol nor a string.

user = Object.new

map = Triad.new
map << [:admin, 'Admin', user]

map.keys('Admin') #=> [:admin]
map.values('Admin') #=> [user]
map.descriptors('Admin') #=> ['Admin']
# or raise Triad::ItemNotPresent

map.descriptors(user) #=> ['Admin']
map.keys(user) #=> [:admin]
map.values(user) #=> [user]
# or raise Triad::ItemNotPresent

map.values(:admin) #=> [user]
map.descriptors(:admin) #=> ['Admin']
map.keys(:admin) #=> [:admin]
# or raise Triad::ItemNotPresent

map.each do |key, descriptor, value|
  #...
end

Installation

Add this line to your application's Gemfile:

gem 'triad'

And then execute:

$ bundle

Or install it yourself as:

$ gem install triad

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