chris_lib 0.0.2 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/chris_lib/chris_math.rb +10 -0
- data/lib/chris_lib/date_ext.rb +3 -0
- data/lib/chris_lib/shell_methods.rb +2 -2
- data/lib/chris_lib/test_access.rb +9 -3
- data/lib/chris_lib/version.rb +1 -1
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5978e0df355ac87f4099c767544b56895f7265cf
|
4
|
+
data.tar.gz: 1189827ab5fed0fac82fde13c9a9c2d44337abfe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 164ee7d1719ca7bf392b290f395d44cd3da2e6bb100e1eb82402cfa545cc5a2444b9e6c4531e6d8fc0148b031d353966b8d82c93ffc2dc3e2109654b0901b367
|
7
|
+
data.tar.gz: cb0163acca7afbda83ce9dad9e20f905298b86fd296a51097e7ad62e585083e9fa1cb9e3d04fa6c7b41cff07c009553fd8b70724ceeb0e623b252235b0a07709
|
data/lib/chris_lib/chris_math.rb
CHANGED
@@ -21,6 +21,16 @@ Array.class_eval do
|
|
21
21
|
m=count-1
|
22
22
|
sum.to_f/m
|
23
23
|
end
|
24
|
+
def median
|
25
|
+
return self[0] if length <= 1
|
26
|
+
sorted = sort
|
27
|
+
n = length
|
28
|
+
if n.odd? # length is odd
|
29
|
+
sorted[n/2]
|
30
|
+
else
|
31
|
+
(sorted[n/2] + sorted[n/2-1]).to_f/2
|
32
|
+
end
|
33
|
+
end
|
24
34
|
end
|
25
35
|
|
26
36
|
module ChrisMath
|
data/lib/chris_lib/date_ext.rb
CHANGED
@@ -11,6 +11,9 @@ module DateExt
|
|
11
11
|
def us_format
|
12
12
|
"#{strftime('%B')} #{day.to_s}, #{year.to_s}"
|
13
13
|
end
|
14
|
+
def short_format
|
15
|
+
"#{strftime('%b')} #{day.to_s}, #{year.to_s}"
|
16
|
+
end
|
14
17
|
def us_format_with_weekday
|
15
18
|
"#{strftime('%A')}, #{strftime('%B')} #{day.to_s}, #{year.to_s}"
|
16
19
|
end
|
@@ -26,8 +26,7 @@ module ShellMethods
|
|
26
26
|
end
|
27
27
|
def check_chris_lib_status
|
28
28
|
gs=`cd ../chris_lib;git status`; lr=$?.success?
|
29
|
-
|
30
|
-
if gs['working directory clean'].nil? || gs['up-to-date'].nil?
|
29
|
+
if gs['working directory clean'].nil? && gs['up-to-date'].nil?
|
31
30
|
puts "Exiting, chris_lib is not up to date with master."
|
32
31
|
exit 3
|
33
32
|
end
|
@@ -43,6 +42,7 @@ module ShellMethods
|
|
43
42
|
puts "No migration necessary"
|
44
43
|
else
|
45
44
|
puts "Warning, different db versions"
|
45
|
+
system('tput bel')
|
46
46
|
puts "Press m<cr> to migrate or q<cr> to exit"
|
47
47
|
ans=$stdin.gets()
|
48
48
|
exit 2 if ans[0]!='m'
|
@@ -8,11 +8,17 @@ module TestAccess
|
|
8
8
|
module ExampleMethods
|
9
9
|
end
|
10
10
|
module ExampleGroupMethods
|
11
|
-
def it_should_route_to(path,actions)
|
11
|
+
def it_should_route_to(path,actions,flash_message=nil)
|
12
12
|
actions.each do |a|
|
13
13
|
it "should deny access to #{a}" do
|
14
|
-
get a, id: 1
|
15
|
-
response.
|
14
|
+
get a.to_sym, id: 1
|
15
|
+
expect(response).to redirect_to send(path)
|
16
|
+
end
|
17
|
+
if flash_message.present?
|
18
|
+
it "should have correct flash message for #{a}" do
|
19
|
+
get a, id: 1
|
20
|
+
expect(flash[:error]).to include flash_message
|
21
|
+
end
|
16
22
|
end
|
17
23
|
end
|
18
24
|
end
|
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: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -42,19 +42,19 @@ dependencies:
|
|
42
42
|
name: rspec-rails
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 2.14.0.rc1
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
55
|
-
description:
|
54
|
+
version: 2.14.0.rc1
|
55
|
+
description: It include maths, datetime, and rspec access test libraries.
|
56
56
|
email:
|
57
|
-
-
|
57
|
+
- obromios@gmail.com
|
58
58
|
executables: []
|
59
59
|
extensions: []
|
60
60
|
extra_rdoc_files: []
|
@@ -88,8 +88,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
88
88
|
version: '0'
|
89
89
|
requirements: []
|
90
90
|
rubyforge_project:
|
91
|
-
rubygems_version: 2.
|
91
|
+
rubygems_version: 2.6.6
|
92
92
|
signing_key:
|
93
93
|
specification_version: 4
|
94
|
-
summary: This
|
94
|
+
summary: This an eclectic collection of methods.
|
95
95
|
test_files: []
|