active_object 5.1.2 → 5.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -8
- data/lib/active_object/enumerable.rb +4 -4
- data/lib/active_object/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4e7d51cc947ed4da6abb8766da99e1133a37d46510bb9d9e2610ac517d0fbf5
|
4
|
+
data.tar.gz: a19337e352af68ebf7bb5b90cbdac51159c04db987b8e460ffd0459b389d6bff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01c29ed208c22c43681ba7eb4b48ca85d172acdf0d61d77ca0ddfdd4413f68c3b932054db56e8857a5041ce45091bb2791ef3018ef372658c7944618f2dee411
|
7
|
+
data.tar.gz: eeb775dbf1e56b3daa43de1a1bfec7b1d9786d67c21bbc919efbfcdd01833013662c46a06454f0714a70ffa6454a36df801bdf8762228c960e5a712563d43d48
|
data/README.md
CHANGED
@@ -388,14 +388,6 @@ end
|
|
388
388
|
[2,3,4].exponential #=> 4096
|
389
389
|
```
|
390
390
|
|
391
|
-
**Frequencies:**
|
392
|
-
`frequencies` returns a hash of the number of times a value in an array appears.
|
393
|
-
|
394
|
-
```ruby
|
395
|
-
[].frequencies #=> {}
|
396
|
-
[1, :symbol, 'string', 3, :symbol, 1].frequencies #=> { 1 => 2, :symbol => 2, 'string' => 1, 3 => 1 }
|
397
|
-
```
|
398
|
-
|
399
391
|
**Incase:**
|
400
392
|
`incase?` the same as #include? but tested using #=== instead of #==.
|
401
393
|
|
@@ -460,6 +452,14 @@ end
|
|
460
452
|
[1,2,3].multiple #=> 6
|
461
453
|
```
|
462
454
|
|
455
|
+
**Occurrences:**
|
456
|
+
`occurrences` returns a hash of the number of times a value in an array appears.
|
457
|
+
|
458
|
+
```ruby
|
459
|
+
[].occurrences #=> {}
|
460
|
+
[1, :symbol, 'string', 3, :symbol, 1].occurrences #=> { 1 => 2, :symbol => 2, 'string' => 1, 3 => 1 }
|
461
|
+
```
|
462
|
+
|
463
463
|
**Percentile:**
|
464
464
|
`percentile` returns the percentile value for a given percentage.
|
465
465
|
|
@@ -135,10 +135,6 @@ if ActiveObject.configuration.autoload_enumerable
|
|
135
135
|
end
|
136
136
|
end
|
137
137
|
|
138
|
-
def frequencies
|
139
|
-
each_with_object(::Hash.new(0)) { |key, hsh| hsh[key] += 1 }
|
140
|
-
end
|
141
|
-
|
142
138
|
# rubocop:disable Style/CaseEquality
|
143
139
|
def incase?(object)
|
144
140
|
any? { |val| object === val }
|
@@ -229,6 +225,10 @@ if ActiveObject.configuration.autoload_enumerable
|
|
229
225
|
end
|
230
226
|
end
|
231
227
|
|
228
|
+
def occurrences
|
229
|
+
each_with_object(::Hash.new(0)) { |key, hsh| hsh[key] += 1 }
|
230
|
+
end
|
231
|
+
|
232
232
|
# rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
233
233
|
def percentile(num, identity = 0)
|
234
234
|
return identity unless length.positive?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_object
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juan Gomez
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -169,7 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
169
169
|
version: '0'
|
170
170
|
requirements: []
|
171
171
|
rubyforge_project:
|
172
|
-
rubygems_version: 2.7.
|
172
|
+
rubygems_version: 2.7.7
|
173
173
|
signing_key:
|
174
174
|
specification_version: 4
|
175
175
|
summary: Gem for commonly used ruby object helpers.
|