cauchy 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a066911b251f0e0cbe301bd90dcaf7e3ec3d2cf9
4
- data.tar.gz: 8637a44b98222b417751327618fda0d55b5a1e57
3
+ metadata.gz: d08afcae445ff25b3d59b8f8d1362e0ee6af672b
4
+ data.tar.gz: 4f34c2abe722c7fb89a13d0c84aa63a654d7ae4d
5
5
  SHA512:
6
- metadata.gz: 64c6a2980ed4869e14a8b0b827afd7a3eb6f7eeb2ed1c47d95e755500cdf34ddb5f1f0497671daaec0ea1b11f1516d050d9f077ca7c429e3e9c5e2cf6f5cfeaf
7
- data.tar.gz: 1a842585547d2b43b1c75482065cd03aaf302c19c2b63f14bb13f1a49d196a3215f551f805e4f72dbaf6604997fa69a14f344e82ef0e9e5f89f1103255ba179a
6
+ metadata.gz: 879d10050c250276d941c9a43caa1bec30e7eb0d541b1206672705f888aaf7913c45bbaf23c06722b21597bd22913120d7a7a7007a00a763d8e5d95b1b0a8410
7
+ data.tar.gz: 994491e4b86f87854906e52ec3933825c5611c2190cd089b508ce90ad2b3bc2deb357b2e7d1be8848486e961643e0c4b00445d5e9066333442f328a725caed67
@@ -12,28 +12,36 @@ module Cauchy
12
12
 
13
13
  def normalize_mapping(hash)
14
14
  hash.deep_stringify_keys.sort.map do |key, field|
15
- if field.key?('properties')
16
- field['properties'] = normalize_mapping(field['properties'])
17
- field['type'] = 'object'
15
+ if field.is_a?(Hash)
16
+ normalize_field(key, field)
17
+ else
18
+ [key, field]
18
19
  end
20
+ end.to_h
21
+ end
19
22
 
20
- if field['type'] == 'date'
21
- field['format'] ||= 'dateOptionalTime'
22
- end
23
+ def normalize_field(key, field)
24
+ if field.key?('properties')
25
+ field['properties'] = normalize_mapping(field['properties'])
26
+ field['type'] ||= 'object'
27
+ end
23
28
 
24
- if ['boolean', 'long', 'double', 'date'].include?(field['type'])
25
- field.delete('analyzer')
26
- field['index'] ||= 'not_analyzed'
27
- end
29
+ if field['type'] == 'date'
30
+ field['format'] ||= 'dateOptionalTime'
31
+ end
28
32
 
29
- if key == 'properties'
30
- field = normalize_mapping(field)
31
- else
32
- field = normalize_value(field)
33
- end
33
+ if ['boolean', 'long', 'double', 'date'].include?(field['type'])
34
+ field.delete('analyzer')
35
+ field['index'] ||= 'not_analyzed'
36
+ end
34
37
 
35
- [key, field]
36
- end.to_h
38
+ if key == 'properties'
39
+ field = normalize_mapping(field)
40
+ else
41
+ field = normalize_value(field)
42
+ end
43
+
44
+ return [key, field]
37
45
  end
38
46
 
39
47
  def normalize_settings(hash)
@@ -1,3 +1,3 @@
1
1
  module Cauchy
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cauchy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Hamera
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-03-15 00:00:00.000000000 Z
12
+ date: 2018-06-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -256,7 +256,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
256
256
  version: '0'
257
257
  requirements: []
258
258
  rubyforge_project:
259
- rubygems_version: 2.4.5.1
259
+ rubygems_version: 2.6.13
260
260
  signing_key:
261
261
  specification_version: 4
262
262
  summary: An elasticsearch schema management tool