chris_lib 2.0.1 → 2.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a49b1a56101739eda525ada550a7ac6d142bfae37daa8cab662ad1da8e2081fa
4
- data.tar.gz: 585607c18aa8cdebbfc56fa8f85afa999a10554f64dec38cd0a34492d2a3f4bb
3
+ metadata.gz: a8e589ae062b5ed85189108754fbaa7d9cbb19b45edced9a8d2fbdf5bca295a2
4
+ data.tar.gz: 321eec2a967da2a904da7909109182087c3317d14ace9c546a5b3ea8156fb773
5
5
  SHA512:
6
- metadata.gz: 2ccbee869659d8937a609458d799902899c13fb6abdd168d3235e0e0713bb52ef6a673778ccbd0a265475e035e7bf75e0cb0634209027dcac47fb023632318e4
7
- data.tar.gz: caaf85adaca705933ffa161441aba021c69c42d74e36ac201723f6d4b939d4b838ebf06a7a7b87a697e242e832c76e177546eccdce122330cfdec382e09b7894
6
+ metadata.gz: ddae70fc4078288c6dc7b5db4f0027eeac0247001d490c85ba5300a58a14cd7aa34b4dfb81b4f8a822a26c5f1dd5ee6e2284c5511c68f5186460bd6e9c64c55a
7
+ data.tar.gz: 81fc5296ba1bd6a8cec244f378fb35312ae7e1deeff4d52da6c822b5a23bb20a450ef7f49ed9aa63270f390f8ae6093c90f0d881580ed63c2548b75be99ebfcb
@@ -32,6 +32,15 @@ Matrix.class_eval do
32
32
  end
33
33
 
34
34
  Array.class_eval do
35
+ # round each element
36
+ def round(decimal_points = 0)
37
+ map { |e| e.round(decimal_points) }
38
+ end
39
+
40
+ def eround(decimal_points = 0)
41
+ map { |e| e.eround(decimal_points) }
42
+ end
43
+
35
44
  # mean of array
36
45
  def mean
37
46
  raise 'Length must be greater than 0.' if length < 1
@@ -75,6 +84,11 @@ Array.class_eval do
75
84
  end
76
85
 
77
86
  Float.class_eval do
87
+ # rounds exponential notation to n decimal places
88
+ def eround(decimal_points = 0)
89
+ ("%.#{decimal_points}e" % self).to_f
90
+ end
91
+
78
92
  def round_down(n=0)
79
93
  # n is decimal place to round down at
80
94
  int,dec=self.to_s.split('.')
@@ -1,3 +1,3 @@
1
1
  module ChrisLib
2
- VERSION = "2.0.1"
2
+ VERSION = "2.0.5"
3
3
  end
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: 2.0.1
4
+ version: 2.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-28 00:00:00.000000000 Z
11
+ date: 2022-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dotenv
@@ -38,6 +38,26 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: actionpack
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 6.1.4
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: 6.1.4.2
51
+ type: :runtime
52
+ prerelease: false
53
+ version_requirements: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - "~>"
56
+ - !ruby/object:Gem::Version
57
+ version: 6.1.4
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: 6.1.4.2
41
61
  - !ruby/object:Gem::Dependency
42
62
  name: rspec
43
63
  requirement: !ruby/object:Gem::Requirement