Module: Ordinal
- Included in:
- Array
- Defined in:
- lib/Ordinal.rb
Overview
Changes since 0.1:
-
require ‘File/self.relative_path’ from Ordinal/Array and replaced with require_relative.
-
-
require ‘File/self.relative_path’ from Ordinal/Array and replaced with require_relative.
-
Instance Method Summary collapse
- #all_but_first ⇒ Object
- #all_but_first_and_last ⇒ Object
- #all_but_last ⇒ Object
- #eighteenth ⇒ Object
- #eighth ⇒ Object
- #eighth_last ⇒ Object
- #eleventh ⇒ Object
- #fifteenth ⇒ Object
- #fifth ⇒ Object
- #fifth_last ⇒ Object
- #first ⇒ Object
- #first_and_last ⇒ Object
- #fourteenth ⇒ Object
- #fourth ⇒ Object
- #fourth_last ⇒ Object
- #last ⇒ Object (also: #first_last)
- #ninteenth ⇒ Object
- #ninth ⇒ Object
- #ninth_last ⇒ Object
- #second ⇒ Object
- #second_last ⇒ Object
- #seventeenth ⇒ Object
- #seventh ⇒ Object
- #seventh_last ⇒ Object
- #sixteenth ⇒ Object
- #sixth ⇒ Object
- #sixth_last ⇒ Object
- #tenth ⇒ Object
- #tenth_last ⇒ Object
- #third ⇒ Object
- #third_last ⇒ Object
- #thirteenth ⇒ Object
- #twelfth ⇒ Object
- #twentieth ⇒ Object
Instance Method Details
#all_but_first ⇒ Object
139 140 141 |
# File 'lib/Ordinal.rb', line 139 def all_but_first entries.drop(1) end |
#all_but_first_and_last ⇒ Object
147 148 149 |
# File 'lib/Ordinal.rb', line 147 def all_but_first_and_last entries.all_but_first.all_but_last end |
#all_but_last ⇒ Object
143 144 145 |
# File 'lib/Ordinal.rb', line 143 def all_but_last entries.take(count - 1) end |
#eighteenth ⇒ Object
86 87 88 |
# File 'lib/Ordinal.rb', line 86 def eighteenth entries[17] end |
#eighth ⇒ Object
46 47 48 |
# File 'lib/Ordinal.rb', line 46 def eighth entries[7] end |
#eighth_last ⇒ Object
106 107 108 |
# File 'lib/Ordinal.rb', line 106 def eighth_last entries[count - 8] end |
#eleventh ⇒ Object
58 59 60 |
# File 'lib/Ordinal.rb', line 58 def eleventh entries[10] end |
#fifteenth ⇒ Object
74 75 76 |
# File 'lib/Ordinal.rb', line 74 def fifteenth entries[14] end |
#fifth ⇒ Object
34 35 36 |
# File 'lib/Ordinal.rb', line 34 def fifth entries[4] end |
#fifth_last ⇒ Object
118 119 120 |
# File 'lib/Ordinal.rb', line 118 def fifth_last entries[count - 5] end |
#first ⇒ Object
18 19 20 |
# File 'lib/Ordinal.rb', line 18 def first entries[0] end |
#first_and_last ⇒ Object
151 152 153 |
# File 'lib/Ordinal.rb', line 151 def first_and_last [entries.first] + [entries.last] end |
#fourteenth ⇒ Object
70 71 72 |
# File 'lib/Ordinal.rb', line 70 def fourteenth entries[13] end |
#fourth ⇒ Object
30 31 32 |
# File 'lib/Ordinal.rb', line 30 def fourth entries[3] end |
#fourth_last ⇒ Object
122 123 124 |
# File 'lib/Ordinal.rb', line 122 def fourth_last entries[count - 4] end |
#last ⇒ Object Also known as: first_last
134 135 136 |
# File 'lib/Ordinal.rb', line 134 def last entries[count - 1] end |
#ninteenth ⇒ Object
90 91 92 |
# File 'lib/Ordinal.rb', line 90 def ninteenth entries[18] end |
#ninth ⇒ Object
50 51 52 |
# File 'lib/Ordinal.rb', line 50 def ninth entries[8] end |
#ninth_last ⇒ Object
102 103 104 |
# File 'lib/Ordinal.rb', line 102 def ninth_last entries[count - 9] end |
#second ⇒ Object
22 23 24 |
# File 'lib/Ordinal.rb', line 22 def second entries[1] end |
#second_last ⇒ Object
130 131 132 |
# File 'lib/Ordinal.rb', line 130 def second_last entries[count - 2] end |
#seventeenth ⇒ Object
82 83 84 |
# File 'lib/Ordinal.rb', line 82 def seventeenth entries[16] end |
#seventh ⇒ Object
42 43 44 |
# File 'lib/Ordinal.rb', line 42 def seventh entries[6] end |
#seventh_last ⇒ Object
110 111 112 |
# File 'lib/Ordinal.rb', line 110 def seventh_last entries[count - 7] end |
#sixteenth ⇒ Object
78 79 80 |
# File 'lib/Ordinal.rb', line 78 def sixteenth entries[15] end |
#sixth ⇒ Object
38 39 40 |
# File 'lib/Ordinal.rb', line 38 def sixth entries[5] end |
#sixth_last ⇒ Object
114 115 116 |
# File 'lib/Ordinal.rb', line 114 def sixth_last entries[count - 6] end |
#tenth ⇒ Object
54 55 56 |
# File 'lib/Ordinal.rb', line 54 def tenth entries[9] end |
#tenth_last ⇒ Object
98 99 100 |
# File 'lib/Ordinal.rb', line 98 def tenth_last entries[count - 10] end |
#third ⇒ Object
26 27 28 |
# File 'lib/Ordinal.rb', line 26 def third entries[2] end |
#third_last ⇒ Object
126 127 128 |
# File 'lib/Ordinal.rb', line 126 def third_last entries[count - 3] end |
#thirteenth ⇒ Object
66 67 68 |
# File 'lib/Ordinal.rb', line 66 def thirteenth entries[12] end |
#twelfth ⇒ Object
62 63 64 |
# File 'lib/Ordinal.rb', line 62 def twelfth entries[11] end |
#twentieth ⇒ Object
94 95 96 |
# File 'lib/Ordinal.rb', line 94 def twentieth entries[19] end |