Project

chair

0.0
No commit activity in last 3 years
No release in over 3 years
A pure ruby table implementation with arbitrary column indices
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 1.6
>= 0
>= 0
 Project Readme

Chair

Build Status Coverage Gem Version

Me: What's the first thing you think of when I say 'Table'?
J: 'Chair'.

Chair is a simple table implementation for Ruby, with an associated Row class.

Installation

Add this line to your application's Gemfile:

gem 'chair'

And then execute:

$ bundle

Or install it yourself as:

$ gem install chair

Usage

>> require 'chair'  
=> true
>> t = Chair.new :title
=> #<Chair:0x0000000162ee08>
>> t.set_primary_key! :title
=> :title
>> t.insert! title: 'Looking for Alaska'
=> #<Chair::Row:0x007feb28035be0>
>> t.find_by_title('Looking for Alaska').to_a
>> ["Looking for Alaska"]
>> t.add_column! :author
=> true
>> t.insert! title: 'An Abundance of Katherines', author: 'John Green'
=> #<Chair::Row>
>> t.add_index! :author
=> true
>> t.find_by_author('John Green').to_a
=> ["An Abundance of Katherines", "John Green"]
>> t.find_by_title('Looking for Alaska')[:author] = 'John Green'
=> 'John Green'
>> r = t.where_author_is 'John Green'
=> [#<Chair::Row>, #<Chair::Row>]
>> r.map {|r| r.to_a}
=> [["An Abundance of Katherines", "John Green"], ["Looking for Alaska", "John Green"]]

Contributing

  1. Fork it ( https://github.com/toroidal-code/chair/fork )
  2. Create your feature branch (git checkout -b features/my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin features/my-new-feature)
  5. Create a new Pull Request