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

  1. /ninteenth/nineteenth/

Instance Method Summary collapse

Instance Method Details

#all_but_firstObject



141
142
143
# File 'lib/Ordinal.rb', line 141

def all_but_first
  entries.drop(1)
end

#all_but_first_and_lastObject



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_lastObject



145
146
147
# File 'lib/Ordinal.rb', line 145

def all_but_last
  entries.take(count - 1)
end

#eighteenthObject



88
89
90
# File 'lib/Ordinal.rb', line 88

def eighteenth
  entries[17]
end

#eighthObject



48
49
50
# File 'lib/Ordinal.rb', line 48

def eighth
  entries[7]
end

#eighth_lastObject



108
109
110
# File 'lib/Ordinal.rb', line 108

def eighth_last
  entries[count - 8]
end

#eleventhObject



60
61
62
# File 'lib/Ordinal.rb', line 60

def eleventh
  entries[10]
end

#fifteenthObject



76
77
78
# File 'lib/Ordinal.rb', line 76

def fifteenth
  entries[14]
end

#fifthObject



36
37
38
# File 'lib/Ordinal.rb', line 36

def fifth
  entries[4]
end

#fifth_lastObject



120
121
122
# File 'lib/Ordinal.rb', line 120

def fifth_last
  entries[count - 5]
end

#firstObject



20
21
22
# File 'lib/Ordinal.rb', line 20

def first
  entries[0]
end

#first_and_lastObject



153
154
155
# File 'lib/Ordinal.rb', line 153

def first_and_last
  [entries.first] + [entries.last]
end

#fourteenthObject



72
73
74
# File 'lib/Ordinal.rb', line 72

def fourteenth
  entries[13]
end

#fourthObject



32
33
34
# File 'lib/Ordinal.rb', line 32

def fourth
  entries[3]
end

#fourth_lastObject



124
125
126
# File 'lib/Ordinal.rb', line 124

def fourth_last
  entries[count - 4]
end

#lastObject Also known as: first_last



136
137
138
# File 'lib/Ordinal.rb', line 136

def last
  entries[count - 1]
end

#nineteenthObject



92
93
94
# File 'lib/Ordinal.rb', line 92

def nineteenth
  entries[18]
end

#ninthObject



52
53
54
# File 'lib/Ordinal.rb', line 52

def ninth
  entries[8]
end

#ninth_lastObject



104
105
106
# File 'lib/Ordinal.rb', line 104

def ninth_last
  entries[count - 9]
end

#secondObject



24
25
26
# File 'lib/Ordinal.rb', line 24

def second
  entries[1]
end

#second_lastObject



132
133
134
# File 'lib/Ordinal.rb', line 132

def second_last
  entries[count - 2]
end

#seventeenthObject



84
85
86
# File 'lib/Ordinal.rb', line 84

def seventeenth
  entries[16]
end

#seventhObject



44
45
46
# File 'lib/Ordinal.rb', line 44

def seventh
  entries[6]
end

#seventh_lastObject



112
113
114
# File 'lib/Ordinal.rb', line 112

def seventh_last
  entries[count - 7]
end

#sixteenthObject



80
81
82
# File 'lib/Ordinal.rb', line 80

def sixteenth
  entries[15]
end

#sixthObject



40
41
42
# File 'lib/Ordinal.rb', line 40

def sixth
  entries[5]
end

#sixth_lastObject



116
117
118
# File 'lib/Ordinal.rb', line 116

def sixth_last
  entries[count - 6]
end

#tenthObject



56
57
58
# File 'lib/Ordinal.rb', line 56

def tenth
  entries[9]
end

#tenth_lastObject



100
101
102
# File 'lib/Ordinal.rb', line 100

def tenth_last
  entries[count - 10]
end

#thirdObject



28
29
30
# File 'lib/Ordinal.rb', line 28

def third
  entries[2]
end

#third_lastObject



128
129
130
# File 'lib/Ordinal.rb', line 128

def third_last
  entries[count - 3]
end

#thirteenthObject



68
69
70
# File 'lib/Ordinal.rb', line 68

def thirteenth
  entries[12]
end

#twelfthObject



64
65
66
# File 'lib/Ordinal.rb', line 64

def twelfth
  entries[11]
end

#twentiethObject



96
97
98
# File 'lib/Ordinal.rb', line 96

def twentieth
  entries[19]
end