to_lookup_hash 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f30118e9d7379301e6b73890614c97bacf9474ca
4
- data.tar.gz: 3a6d8d2598f06ad6abbe589c802750dc30c8c7a1
3
+ metadata.gz: c0f5771194fecfd548edc95c643cd4992e6fdae9
4
+ data.tar.gz: 644a4afc428ff37a5cc04b04834102167c6c330c
5
5
  SHA512:
6
- metadata.gz: e1037f86300d5533a236c55adf56992b359076bfbe6c12d239c3596dcf7176579c14f19f25e38f54619726887789fc7f31384adddfe73554a3cf4c634f6d31b9
7
- data.tar.gz: 4c35f2e1432a36867a3bca8bffa56b55cc6a934a95ee2660929e54c0675ffaceff98ca0b17fcc6fdc0859277137db990b4a59e73585e7c633237d9aad6b7c9d6
6
+ metadata.gz: 7ad6c245c9f532edaa5db8bdbadfc8b4bbfe7dfa652157eff467791ea0bb9deb16181dbff4e1aca4002153069ac8a37a7e240c874afb20d3c7671302eeffcb3d
7
+ data.tar.gz: 02b0494f0b87dbd2d53f7ddf4a1c701f7a60b5e6c4809cb78a0ed91bdc0f8d1ac996343d103c0a90e3a98fc601fbeebb892d93b31a9d4dbe1062ed935bf891f6
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # ToLookupHash
2
2
 
3
- TODO: Write a gem description
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
- TODO: Write usage instructions here
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
 
@@ -1,3 +1,3 @@
1
1
  module ToLookupHash
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -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.1
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: {}