creative_rails_utilities 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +14 -0
- data/lib/creative_rails_utilities/array.rb +12 -0
- data/lib/creative_rails_utilities/version.rb +1 -1
- data/lib/creative_rails_utilities.rb +4 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 05cb9d231a2ce10ff623f11bfb2c279e509bf1c3
|
4
|
+
data.tar.gz: e420b4d185fb32b3567dfd704ba161e7401deae1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 25e3bef44073c8256869afff81c3e146460706f3aee318c5241592ae6b04c4300babb77a14bc57be360f031185b356b796134aee370a8f6eb07ab2de3f9ba44a
|
7
|
+
data.tar.gz: 9cd6e337b76da4aff9333ac3095b421bd9ea3eca92fee610f485ea2ea7ee385d6f417dc1d2323d1c83d31bdd6efc51a024bd841f487c348eff65856b5167af48
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -12,6 +12,20 @@ Intended for `Rails >= 4.0.0`, but will probably work for older projects with ro
|
|
12
12
|
|
13
13
|
Feel free to read the source under `/lib/creative_rails_utilities/` and peruse the method "it" lines under `/spec`
|
14
14
|
|
15
|
+
##### Array
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
# Array#histogram # returns a histogram hash of elements sorted by most value first
|
19
|
+
%i|c a b a a b|.histogram
|
20
|
+
# => {a: 3, b: 2, c: 1}
|
21
|
+
```
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
# Array#by_popularity # returns a semi-histogram array of unique elements sorted by most numerous element first
|
25
|
+
%i|c a b a a b|.histogram
|
26
|
+
# => [:a, :b, :c]}
|
27
|
+
```
|
28
|
+
|
15
29
|
##### Date
|
16
30
|
|
17
31
|
```ruby
|
@@ -4,9 +4,11 @@ require 'active_support/core_ext'
|
|
4
4
|
require 'hashrush'
|
5
5
|
require 'ruby_dig'
|
6
6
|
|
7
|
-
require "creative_rails_utilities/error_helper"
|
8
|
-
|
7
|
+
require "creative_rails_utilities/error_helper" # higher because require order reasons
|
8
|
+
|
9
|
+
require "creative_rails_utilities/array"
|
9
10
|
require "creative_rails_utilities/date"
|
11
|
+
require "creative_rails_utilities/hash"
|
10
12
|
require "creative_rails_utilities/numeric"
|
11
13
|
require "creative_rails_utilities/object"
|
12
14
|
require "creative_rails_utilities/string"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: creative_rails_utilities
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Creative
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-07-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -171,6 +171,7 @@ files:
|
|
171
171
|
- bin/setup
|
172
172
|
- creative_rails_utilities.gemspec
|
173
173
|
- lib/creative_rails_utilities.rb
|
174
|
+
- lib/creative_rails_utilities/array.rb
|
174
175
|
- lib/creative_rails_utilities/date.rb
|
175
176
|
- lib/creative_rails_utilities/error_helper.rb
|
176
177
|
- lib/creative_rails_utilities/hash.rb
|