A cyclic data structure for Ruby
Ruby
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
spec
.gitignore
Gemfile
README
Rakefile
circular_list.gemspec

README

Circular List
=============

A circular list data structure for Ruby.

How to install
--------------

gem install circular_list

OR

gem 'circular_list'  in Gemfile


How to use
----------

require 'rubygems'
require 'circular_list'

c = CircularList::List.new([1,2,3])
c.fetch_next   => 2
c.fetch_next   => 3
c.fetch_next   => 1
c.fetch_next   => 2

c = CircularList::List.new([1,2,3])
c.fetch_previous   => 3
c.fetch_previous   => 2
c.fetch_previous   => 1
c.fetch_previous   => 3

See specs https://github.com/bangthetable/CircularList/blob/master/spec/circular_list/list_spec.rb for more examples.