0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
You can access to the first element of an array by the 'first' method. Now you can access to the second element by 'second' and that until the 999th elements
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

Ordinal array¶ ↑

<img src=“https://codeclimate.com/badge.png” />

Ordinal array is a Gem which allows you to access to a value of an array by an ordinal value. You can access to the first element of an array by the “first” method. Now you can access to the second element by “second”, the third by “third” and that until the 999th elements.

Works with Ruby 1.9

Improve ordinal array speed for multiple calls on the same method on the same array: (Benchmark results: gist.github.com/2337544)

Exemple:

my_array = ["value1", "value2", "value3"]
puts my_array.third # print: value 3
puts my_array.third # print: value 3 (But... much faster!)

How to use¶ ↑

Just add gem “ordinal_array” in your gemfile. It provides you some methods on the basic array class

Exemple of use:

my_array = ["value1", "value2", "value3"]
puts my_array.third # print: value 3
my_array[41] = "it works fine"
puts my_array.fourty_second # print: it works fine

Contributors¶ ↑

*Kevin Disneur