to_lookup_hash 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +16 -2
- data/lib/to_lookup_hash/version.rb +1 -1
- data/to_lookup_hash.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0f5771194fecfd548edc95c643cd4992e6fdae9
|
4
|
+
data.tar.gz: 644a4afc428ff37a5cc04b04834102167c6c330c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ad6c245c9f532edaa5db8bdbadfc8b4bbfe7dfa652157eff467791ea0bb9deb16181dbff4e1aca4002153069ac8a37a7e240c874afb20d3c7671302eeffcb3d
|
7
|
+
data.tar.gz: 02b0494f0b87dbd2d53f7ddf4a1c701f7a60b5e6c4809cb78a0ed91bdc0f8d1ac996343d103c0a90e3a98fc601fbeebb892d93b31a9d4dbe1062ed935bf891f6
|
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# ToLookupHash
|
2
2
|
|
3
|
-
|
3
|
+
Easily generate a lookup hash from an Enumerable to later
|
4
|
+
perform repeated searches by something
|
4
5
|
|
5
6
|
## Installation
|
6
7
|
|
@@ -18,7 +19,20 @@ Or install it yourself as:
|
|
18
19
|
|
19
20
|
## Usage
|
20
21
|
|
21
|
-
|
22
|
+
```ruby
|
23
|
+
Person = Struct.new(:name, :surname)
|
24
|
+
people = [Person.new('John', 'Smith'), Person.new('Jim', 'Dougan')]
|
25
|
+
|
26
|
+
people.to_lookup_hash(&:name)
|
27
|
+
# => {"John"=>#<struct Person name="John", surname="Smith">, "Jim"=>#<struct Person name="Jim", surname="Dougan">}
|
28
|
+
|
29
|
+
|
30
|
+
people.to_lookup_hash_with_value do |person|
|
31
|
+
[person.name, person.surname]
|
32
|
+
end
|
33
|
+
# => {"John"=>"Smith", "Jim"=>"Dougan"}
|
34
|
+
|
35
|
+
```
|
22
36
|
|
23
37
|
## Contributing
|
24
38
|
|
data/to_lookup_hash.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["pawel.obrok@gmail.com"]
|
11
11
|
spec.description = %q{Adds methods for converting enumerables to lookup hashes}
|
12
12
|
spec.summary = %q{Adds methods for converting enumerables to lookup hashes}
|
13
|
-
spec.homepage = ""
|
13
|
+
spec.homepage = "https://github.com/basecrm/to_lookup_hash"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files`.split($/)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: to_lookup_hash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paweł Obrok
|
@@ -69,7 +69,7 @@ files:
|
|
69
69
|
- lib/to_lookup_hash/version.rb
|
70
70
|
- spec/enumerable_extensions_spec.rb
|
71
71
|
- to_lookup_hash.gemspec
|
72
|
-
homepage:
|
72
|
+
homepage: https://github.com/basecrm/to_lookup_hash
|
73
73
|
licenses:
|
74
74
|
- MIT
|
75
75
|
metadata: {}
|