ine-places 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ine/places/csv_record.rb +17 -3
- data/lib/ine/places/version.rb +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: 37968cbbe43babded7fa90ed6443e4a3bf468ab0
|
4
|
+
data.tar.gz: a1a1cce2d4ddda066214c7687236ca9c57a15a96
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a962e604b8ffd396d685e004bdfac84e757795b5b8794e5fa8eb8d8389e8e80145ba3ea3686aba2f21f738db7c364c6c2cb9704a9123aa46a21b3930741b925
|
7
|
+
data.tar.gz: ea1e7bb6c4089962ab6a09a9de2184fad1385affe22cd92e7ad914f69341a977e37d65be14450803b551bcb2dcd3315167703079cd2e2b5d8e1447a26a3a111a
|
@@ -14,19 +14,33 @@ module INE::Places::CSVRecord
|
|
14
14
|
def find_by_name(name)
|
15
15
|
raise ArgumentError if name.blank?
|
16
16
|
|
17
|
-
|
17
|
+
records_by_name[name]
|
18
18
|
end
|
19
19
|
|
20
20
|
def find_by_slug(slug)
|
21
21
|
raise ArgumentError if slug.blank?
|
22
22
|
|
23
|
-
|
23
|
+
records_by_slug[slug]
|
24
24
|
end
|
25
25
|
|
26
26
|
def find(id)
|
27
27
|
raise ArgumentError if id.blank?
|
28
28
|
|
29
|
-
|
29
|
+
records_by_id[id.to_i]
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def records_by_id
|
35
|
+
@records_by_id ||= Hash[collection_klass.records.map{ |record| [record.id.to_i, record] }]
|
36
|
+
end
|
37
|
+
|
38
|
+
def records_by_slug
|
39
|
+
@records_by_slug ||= Hash[collection_klass.records.map{ |record| [record.slug, record] }]
|
40
|
+
end
|
41
|
+
|
42
|
+
def records_by_name
|
43
|
+
@records_by_name ||= Hash[collection_klass.records.map{ |record| [record.name, record] }]
|
30
44
|
end
|
31
45
|
end
|
32
46
|
end
|
data/lib/ine/places/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ine-places
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fernando Blat
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|