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.
-
0/1
-
/ninteenth/nineteenth/
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)
- #nineteenth ⇒ 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
141 142 143 |
# File 'lib/Ordinal.rb', line 141 def all_but_first entries.drop(1) end |
#all_but_first_and_last ⇒ Object
149 150 151 |
# File 'lib/Ordinal.rb', line 149 def all_but_first_and_last entries.all_but_first.all_but_last end |
#all_but_last ⇒ Object
145 146 147 |
# File 'lib/Ordinal.rb', line 145 def all_but_last entries.take(count - 1) end |
#eighteenth ⇒ Object
88 89 90 |
# File 'lib/Ordinal.rb', line 88 def eighteenth entries[17] end |
#eighth ⇒ Object
48 49 50 |
# File 'lib/Ordinal.rb', line 48 def eighth entries[7] end |
#eighth_last ⇒ Object
108 109 110 |
# File 'lib/Ordinal.rb', line 108 def eighth_last entries[count - 8] end |
#eleventh ⇒ Object
60 61 62 |
# File 'lib/Ordinal.rb', line 60 def eleventh entries[10] end |
#fifteenth ⇒ Object
76 77 78 |
# File 'lib/Ordinal.rb', line 76 def fifteenth entries[14] end |
#fifth ⇒ Object
36 37 38 |
# File 'lib/Ordinal.rb', line 36 def fifth entries[4] end |
#fifth_last ⇒ Object
120 121 122 |
# File 'lib/Ordinal.rb', line 120 def fifth_last entries[count - 5] end |
#first ⇒ Object
20 21 22 |
# File 'lib/Ordinal.rb', line 20 def first entries[0] end |
#first_and_last ⇒ Object
153 154 155 |
# File 'lib/Ordinal.rb', line 153 def first_and_last [entries.first] + [entries.last] end |
#fourteenth ⇒ Object
72 73 74 |
# File 'lib/Ordinal.rb', line 72 def fourteenth entries[13] end |
#fourth ⇒ Object
32 33 34 |
# File 'lib/Ordinal.rb', line 32 def fourth entries[3] end |
#fourth_last ⇒ Object
124 125 126 |
# File 'lib/Ordinal.rb', line 124 def fourth_last entries[count - 4] end |
#last ⇒ Object Also known as: first_last
136 137 138 |
# File 'lib/Ordinal.rb', line 136 def last entries[count - 1] end |
#nineteenth ⇒ Object
92 93 94 |
# File 'lib/Ordinal.rb', line 92 def nineteenth entries[18] end |
#ninth ⇒ Object
52 53 54 |
# File 'lib/Ordinal.rb', line 52 def ninth entries[8] end |
#ninth_last ⇒ Object
104 105 106 |
# File 'lib/Ordinal.rb', line 104 def ninth_last entries[count - 9] end |
#second ⇒ Object
24 25 26 |
# File 'lib/Ordinal.rb', line 24 def second entries[1] end |
#second_last ⇒ Object
132 133 134 |
# File 'lib/Ordinal.rb', line 132 def second_last entries[count - 2] end |
#seventeenth ⇒ Object
84 85 86 |
# File 'lib/Ordinal.rb', line 84 def seventeenth entries[16] end |
#seventh ⇒ Object
44 45 46 |
# File 'lib/Ordinal.rb', line 44 def seventh entries[6] end |
#seventh_last ⇒ Object
112 113 114 |
# File 'lib/Ordinal.rb', line 112 def seventh_last entries[count - 7] end |
#sixteenth ⇒ Object
80 81 82 |
# File 'lib/Ordinal.rb', line 80 def sixteenth entries[15] end |
#sixth ⇒ Object
40 41 42 |
# File 'lib/Ordinal.rb', line 40 def sixth entries[5] end |
#sixth_last ⇒ Object
116 117 118 |
# File 'lib/Ordinal.rb', line 116 def sixth_last entries[count - 6] end |
#tenth ⇒ Object
56 57 58 |
# File 'lib/Ordinal.rb', line 56 def tenth entries[9] end |
#tenth_last ⇒ Object
100 101 102 |
# File 'lib/Ordinal.rb', line 100 def tenth_last entries[count - 10] end |
#third ⇒ Object
28 29 30 |
# File 'lib/Ordinal.rb', line 28 def third entries[2] end |
#third_last ⇒ Object
128 129 130 |
# File 'lib/Ordinal.rb', line 128 def third_last entries[count - 3] end |
#thirteenth ⇒ Object
68 69 70 |
# File 'lib/Ordinal.rb', line 68 def thirteenth entries[12] end |
#twelfth ⇒ Object
64 65 66 |
# File 'lib/Ordinal.rb', line 64 def twelfth entries[11] end |
#twentieth ⇒ Object
96 97 98 |
# File 'lib/Ordinal.rb', line 96 def twentieth entries[19] end |