chris_lib 1.1.5 → 1.1.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/chris_lib/chris_math.rb +9 -0
- data/lib/chris_lib/date_ext.rb +33 -23
- data/lib/chris_lib/version.rb +1 -1
- metadata +134 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7af77d04c120dacf88cc6d208c51e31c7d8eb35b280cfba48b93f0815329053c
|
4
|
+
data.tar.gz: 276f996bd4f5bd2a81b00c6ece959cf4bb26206e70970087022beea1d49eb3a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4ff3203d46941297016836351413c0116e19a288514b32cd2febb4bc1913fe4d679be202da0296cefe6c570ceb77238c932742e002c73cff33e76c1c0111914
|
7
|
+
data.tar.gz: 1c046877f6451c2b144f8f2dfded4d148eb2cbc2d00ec2e0b2d9cc73d5d19af52add06b6c8347a82a35f43e977cc041a6752000054ce748dd43e8c1ef0b36e8f
|
data/lib/chris_lib/chris_math.rb
CHANGED
@@ -8,6 +8,15 @@ Integer.class_eval do
|
|
8
8
|
end
|
9
9
|
end
|
10
10
|
end
|
11
|
+
|
12
|
+
Matrix.class_eval do
|
13
|
+
def pinv
|
14
|
+
full_rank = (rank == [row_count, column_count].min)
|
15
|
+
raise ExceptionForMatrix::ErrNotRegular unless full_rank
|
16
|
+
transpose * (self * transpose).inv
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
11
20
|
Array.class_eval do
|
12
21
|
# mean of array
|
13
22
|
def mean
|
data/lib/chris_lib/date_ext.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# extensions to Date
|
1
2
|
module DateExt
|
2
3
|
# To format a date, use <tt>date.charmians_format</tt>
|
3
4
|
# on any Date object.
|
@@ -6,41 +7,50 @@ module DateExt
|
|
6
7
|
# charmians_format
|
7
8
|
# end
|
8
9
|
#
|
9
|
-
# If using a DateTime object, need to convert to date i.e.
|
10
|
+
# If using a DateTime object, need to convert to date i.e.
|
11
|
+
# <tt>datetime.to_date.charmians_format</tt>.
|
10
12
|
Date.class_eval do
|
11
13
|
def us_format
|
12
|
-
"#{strftime('%B')} #{day
|
14
|
+
"#{strftime('%B')} #{day}, #{year}"
|
13
15
|
end
|
16
|
+
|
14
17
|
def short_format
|
15
|
-
"#{strftime('%b')} #{day
|
18
|
+
"#{strftime('%b')} #{day}, #{year}"
|
16
19
|
end
|
20
|
+
|
17
21
|
def us_format_with_weekday
|
18
|
-
|
22
|
+
"#{strftime('%A')}, #{strftime('%B')} #{day}, #{year}"
|
19
23
|
end
|
24
|
+
|
20
25
|
def charmians_format
|
21
|
-
|
22
|
-
|
26
|
+
d = cardinalation(day)
|
27
|
+
"#{strftime('%A')}, #{d} #{strftime('%B')}, #{year}"
|
23
28
|
end
|
29
|
+
|
24
30
|
def charmians_format_sup
|
25
|
-
|
26
|
-
|
31
|
+
d = cardinalation(day, true)
|
32
|
+
"#{strftime('%A')}, #{d} #{strftime('%B')}, #{year}"
|
27
33
|
end
|
34
|
+
|
28
35
|
private
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
36
|
+
|
37
|
+
def cardinalation(day, html_sup = false)
|
38
|
+
s = suffix day
|
39
|
+
s = "<sup>#{s}</sup>" if html_sup
|
40
|
+
"#{day}#{s}"
|
41
|
+
end
|
42
|
+
|
43
|
+
def suffix(day)
|
44
|
+
case day
|
45
|
+
when 1, 21, 31
|
46
|
+
'st'
|
47
|
+
when 2, 22
|
48
|
+
'nd'
|
49
|
+
when 3, 23
|
50
|
+
'rd'
|
51
|
+
else
|
52
|
+
'th'
|
53
|
+
end
|
42
54
|
end
|
43
55
|
end
|
44
56
|
end
|
45
|
-
|
46
|
-
|
data/lib/chris_lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chris_lib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-05-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dotenv
|
@@ -31,19 +31,65 @@ dependencies:
|
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 2.2.1
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
|
-
name:
|
34
|
+
name: actionview
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '5.1'
|
37
40
|
- - ">="
|
38
41
|
- !ruby/object:Gem::Version
|
39
|
-
version:
|
40
|
-
type: :
|
42
|
+
version: 5.2.4.3
|
43
|
+
type: :development
|
44
|
+
prerelease: false
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '5.1'
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 5.2.4.3
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: actionpack
|
55
|
+
requirement: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - "~>"
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '5.2'
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 5.2.4.6
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '5.2'
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: 5.2.4.6
|
73
|
+
- !ruby/object:Gem::Dependency
|
74
|
+
name: loofah
|
75
|
+
requirement: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - "~>"
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '2.3'
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 2.3.1
|
83
|
+
type: :development
|
41
84
|
prerelease: false
|
42
85
|
version_requirements: !ruby/object:Gem::Requirement
|
43
86
|
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '2.3'
|
44
90
|
- - ">="
|
45
91
|
- !ruby/object:Gem::Version
|
46
|
-
version:
|
92
|
+
version: 2.3.1
|
47
93
|
- !ruby/object:Gem::Dependency
|
48
94
|
name: rails
|
49
95
|
requirement: !ruby/object:Gem::Requirement
|
@@ -53,7 +99,7 @@ dependencies:
|
|
53
99
|
version: '5.1'
|
54
100
|
- - ">="
|
55
101
|
- !ruby/object:Gem::Version
|
56
|
-
version: 5.1.6
|
102
|
+
version: 5.1.4.6
|
57
103
|
type: :development
|
58
104
|
prerelease: false
|
59
105
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -63,7 +109,27 @@ dependencies:
|
|
63
109
|
version: '5.1'
|
64
110
|
- - ">="
|
65
111
|
- !ruby/object:Gem::Version
|
66
|
-
version: 5.1.6
|
112
|
+
version: 5.1.4.6
|
113
|
+
- !ruby/object:Gem::Dependency
|
114
|
+
name: rspec-rails
|
115
|
+
requirement: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - "~>"
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '3.7'
|
120
|
+
- - ">="
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: 3.7.2
|
123
|
+
type: :development
|
124
|
+
prerelease: false
|
125
|
+
version_requirements: !ruby/object:Gem::Requirement
|
126
|
+
requirements:
|
127
|
+
- - "~>"
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '3.7'
|
130
|
+
- - ">="
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: 3.7.2
|
67
133
|
- !ruby/object:Gem::Dependency
|
68
134
|
name: sqlite3
|
69
135
|
requirement: !ruby/object:Gem::Requirement
|
@@ -85,39 +151,87 @@ dependencies:
|
|
85
151
|
- !ruby/object:Gem::Version
|
86
152
|
version: 1.3.11
|
87
153
|
- !ruby/object:Gem::Dependency
|
88
|
-
name:
|
154
|
+
name: nokogiri
|
89
155
|
requirement: !ruby/object:Gem::Requirement
|
90
156
|
requirements:
|
91
157
|
- - "~>"
|
92
158
|
- !ruby/object:Gem::Version
|
93
|
-
version: '
|
159
|
+
version: '1.10'
|
94
160
|
- - ">="
|
95
161
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
162
|
+
version: 1.11.4
|
97
163
|
type: :development
|
98
164
|
prerelease: false
|
99
165
|
version_requirements: !ruby/object:Gem::Requirement
|
100
166
|
requirements:
|
101
167
|
- - "~>"
|
102
168
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
169
|
+
version: '1.10'
|
104
170
|
- - ">="
|
105
171
|
- !ruby/object:Gem::Version
|
106
|
-
version:
|
172
|
+
version: 1.11.4
|
107
173
|
- !ruby/object:Gem::Dependency
|
108
|
-
name:
|
174
|
+
name: rack
|
175
|
+
requirement: !ruby/object:Gem::Requirement
|
176
|
+
requirements:
|
177
|
+
- - "~>"
|
178
|
+
- !ruby/object:Gem::Version
|
179
|
+
version: '2.0'
|
180
|
+
- - ">="
|
181
|
+
- !ruby/object:Gem::Version
|
182
|
+
version: 2.2.3
|
183
|
+
type: :development
|
184
|
+
prerelease: false
|
185
|
+
version_requirements: !ruby/object:Gem::Requirement
|
186
|
+
requirements:
|
187
|
+
- - "~>"
|
188
|
+
- !ruby/object:Gem::Version
|
189
|
+
version: '2.0'
|
190
|
+
- - ">="
|
191
|
+
- !ruby/object:Gem::Version
|
192
|
+
version: 2.2.3
|
193
|
+
- !ruby/object:Gem::Dependency
|
194
|
+
name: sass-rails
|
195
|
+
requirement: !ruby/object:Gem::Requirement
|
196
|
+
requirements:
|
197
|
+
- - ">="
|
198
|
+
- !ruby/object:Gem::Version
|
199
|
+
version: '0'
|
200
|
+
type: :development
|
201
|
+
prerelease: false
|
202
|
+
version_requirements: !ruby/object:Gem::Requirement
|
203
|
+
requirements:
|
204
|
+
- - ">="
|
205
|
+
- !ruby/object:Gem::Version
|
206
|
+
version: '0'
|
207
|
+
- !ruby/object:Gem::Dependency
|
208
|
+
name: uglifier
|
209
|
+
requirement: !ruby/object:Gem::Requirement
|
210
|
+
requirements:
|
211
|
+
- - ">="
|
212
|
+
- !ruby/object:Gem::Version
|
213
|
+
version: '0'
|
214
|
+
type: :development
|
215
|
+
prerelease: false
|
216
|
+
version_requirements: !ruby/object:Gem::Requirement
|
217
|
+
requirements:
|
218
|
+
- - ">="
|
219
|
+
- !ruby/object:Gem::Version
|
220
|
+
version: '0'
|
221
|
+
- !ruby/object:Gem::Dependency
|
222
|
+
name: jquery-rails
|
109
223
|
requirement: !ruby/object:Gem::Requirement
|
110
224
|
requirements:
|
111
225
|
- - ">="
|
112
226
|
- !ruby/object:Gem::Version
|
113
|
-
version:
|
227
|
+
version: '0'
|
114
228
|
type: :development
|
115
229
|
prerelease: false
|
116
230
|
version_requirements: !ruby/object:Gem::Requirement
|
117
231
|
requirements:
|
118
232
|
- - ">="
|
119
233
|
- !ruby/object:Gem::Version
|
120
|
-
version:
|
234
|
+
version: '0'
|
121
235
|
description: It includes maths, datetime, and rspec access test libraries.
|
122
236
|
email:
|
123
237
|
- obromios@gmail.com
|
@@ -140,7 +254,7 @@ licenses:
|
|
140
254
|
metadata:
|
141
255
|
source_code_uri: https://github.com/obromios/chris_lib
|
142
256
|
changelog_uri: https://github.com/obromios/chris_lib/blob/master/CHANGELOG.md
|
143
|
-
post_install_message:
|
257
|
+
post_install_message:
|
144
258
|
rdoc_options: []
|
145
259
|
require_paths:
|
146
260
|
- lib
|
@@ -155,9 +269,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
155
269
|
- !ruby/object:Gem::Version
|
156
270
|
version: '0'
|
157
271
|
requirements: []
|
158
|
-
|
159
|
-
|
160
|
-
signing_key:
|
272
|
+
rubygems_version: 3.1.2
|
273
|
+
signing_key:
|
161
274
|
specification_version: 4
|
162
275
|
summary: This an eclectic collection of methods. It include maths, datetime, and rspec
|
163
276
|
access test libraries.
|