inactive_support 0.1.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +33 -1
- data/lib/inactive_support/version.rb +1 -1
- metadata +15 -29
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4fb7998869a0bba3ac1bb5605f625f65f2684c5d
|
4
|
+
data.tar.gz: 649925baa3a002f3d57f40b59d2d6c034ae061ac
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 74563eae66da697c6689860fa20beb6dffbda7e19295c6006443193b958e3f201488713de146afdfb1c8f27b34ef3d42a0c0e7bbdacd00d88ba1c31d46330a33
|
7
|
+
data.tar.gz: becbcbaa2fbbe33510ee8d9b6726e2d7efa37474c90edf5c30c19686d37ed1446406da7e2654e5514b4a195f00af359711ebc2aff93bf0ea4af1ed9800b06613
|
data/README.md
CHANGED
@@ -18,7 +18,39 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
-
|
21
|
+
### Object
|
22
|
+
#### #identity
|
23
|
+
returns self
|
24
|
+
|
25
|
+
[1,2,3,3,4,5,5].group_by(&:identity)
|
26
|
+
# => [[1], [2], [3,3], [4], [5,5]]
|
27
|
+
|
28
|
+
#### #try
|
29
|
+
send a message to the receiver and if it doesn't respond to the message, return nil
|
30
|
+
|
31
|
+
"".try(:some_method)
|
32
|
+
# => nil
|
33
|
+
|
34
|
+
#### #ctry
|
35
|
+
chained try, for methods with no arguments
|
36
|
+
|
37
|
+
"Somestring".ctry(:mb_chars, :downcase, :some_method)
|
38
|
+
# => nil
|
39
|
+
|
40
|
+
### Hash
|
41
|
+
#### #delete_blank
|
42
|
+
Deletes all key/value pairs where the value is an empty string/array/hash or nil.
|
43
|
+
|
44
|
+
{ name: nil, age: 19, address: "" }.delete_blank
|
45
|
+
# => { age: 19 }
|
46
|
+
|
47
|
+
### Enumerable
|
48
|
+
#### #consecutive_by
|
49
|
+
groups objects by an attribute that is consecutive
|
50
|
+
|
51
|
+
[1,2,3,5,6,8,9].consecutive_by(&:identity)
|
52
|
+
# => [[1,2,3],[5,6],[8,9]]
|
53
|
+
|
22
54
|
|
23
55
|
## Contributing
|
24
56
|
|
metadata
CHANGED
@@ -1,62 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inactive_support
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
5
|
-
prerelease:
|
4
|
+
version: 1.0.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- gmitrev
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-26 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: bundler
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- - ~>
|
17
|
+
- - "~>"
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '1.3'
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- - ~>
|
24
|
+
- - "~>"
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '1.3'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rake
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - ">="
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - ">="
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: rspec
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- - ~>
|
45
|
+
- - "~>"
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '2.6'
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- - ~>
|
52
|
+
- - "~>"
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '2.6'
|
62
55
|
description: A collection of utilities and extensions
|
@@ -66,8 +59,8 @@ executables: []
|
|
66
59
|
extensions: []
|
67
60
|
extra_rdoc_files: []
|
68
61
|
files:
|
69
|
-
- .gitignore
|
70
|
-
- .rspec
|
62
|
+
- ".gitignore"
|
63
|
+
- ".rspec"
|
71
64
|
- Gemfile
|
72
65
|
- LICENSE.txt
|
73
66
|
- README.md
|
@@ -90,33 +83,26 @@ files:
|
|
90
83
|
homepage: ''
|
91
84
|
licenses:
|
92
85
|
- MIT
|
86
|
+
metadata: {}
|
93
87
|
post_install_message:
|
94
88
|
rdoc_options: []
|
95
89
|
require_paths:
|
96
90
|
- lib
|
97
91
|
required_ruby_version: !ruby/object:Gem::Requirement
|
98
|
-
none: false
|
99
92
|
requirements:
|
100
|
-
- -
|
93
|
+
- - ">="
|
101
94
|
- !ruby/object:Gem::Version
|
102
95
|
version: '0'
|
103
|
-
segments:
|
104
|
-
- 0
|
105
|
-
hash: 106245937
|
106
96
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
|
-
none: false
|
108
97
|
requirements:
|
109
|
-
- -
|
98
|
+
- - ">="
|
110
99
|
- !ruby/object:Gem::Version
|
111
100
|
version: '0'
|
112
|
-
segments:
|
113
|
-
- 0
|
114
|
-
hash: 106245937
|
115
101
|
requirements: []
|
116
102
|
rubyforge_project:
|
117
|
-
rubygems_version:
|
103
|
+
rubygems_version: 2.2.2
|
118
104
|
signing_key:
|
119
|
-
specification_version:
|
105
|
+
specification_version: 4
|
120
106
|
summary: Snippets and useful stuff extracted from my projects
|
121
107
|
test_files:
|
122
108
|
- spec/lib/hash_spec.rb
|