artirix_data_models 1.0.0.beta2 → 1.0.0.beta3

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: 7b789a4325708b34bd7ebfdc7745857c0b15c274
4
- data.tar.gz: a0b4df2ed3b9a82761ad7b7474d2456c7c1ec622
3
+ metadata.gz: ae18a031f2f63e51b88e650af33f00514be973f3
4
+ data.tar.gz: 47cacfc9d39fe71f601a24a2b0a98592fff96ed9
5
5
  SHA512:
6
- metadata.gz: b3067423501cef36002fc3c46a8d1bca73541ed2cfd92acb068b704472dca356d2c771f3e4434a554983dbe86f0b2956bcf181cf4d0554b8294c778572c1c6e4
7
- data.tar.gz: d82ad3c5b183de485ddd6c3d85b749fe03abb5b5ba3dbd9c8c3ed9c3ad1918338fca8d08eb6e22efa000d8ac1fdd1ac4885fb9357d4dd48f393e7d40f8bcd242
6
+ metadata.gz: 56fc976f72c5fb3fac636946094f16904795a611ded1b1b4c45bf30b0cf618ea769d7882ccc6ee914b4d8d571eed78c3d9d15e4f522ac8db468dd1986592fec8
7
+ data.tar.gz: 6c8b20e6e3c5fcd5efde31dd1069692fda9e8286f3dab37f0170bd25910a051504f81aff5b83d0206a292a9d930fa4848b4d8f911af3986cc87c7bcfd0f981ba
data/.gitignore CHANGED
@@ -1,7 +1,7 @@
1
1
  /.bundle/
2
2
  /.yardoc
3
- /Gemfile.lock
4
3
  /_yardoc/
4
+ /Gemfile.lock
5
5
  /coverage/
6
6
  /doc/
7
7
  /pkg/
data/README.md CHANGED
@@ -320,6 +320,10 @@ end
320
320
 
321
321
  ## Changes
322
322
 
323
+ ### 1.0.0.beta3
324
+
325
+ - remove `hashie` dependency. Important: `EsCollection` breaks with hashie 3.5.x before this change
326
+
323
327
  ### 1.0.0.beta2
324
328
 
325
329
  - Partial Mode: the default mode status is inherited from the parent class. If you have
@@ -24,7 +24,6 @@ Gem::Specification.new do |spec|
24
24
  spec.add_dependency 'faraday'
25
25
  spec.add_dependency 'keyword_init', '~> 1.4'
26
26
  spec.add_dependency 'naught'
27
- spec.add_dependency 'hashie', '~> 3.4'
28
27
  spec.add_dependency 'artirix_cache_service'
29
28
 
30
29
  spec.add_development_dependency 'simpleconfig'
@@ -7,7 +7,6 @@ require 'oj'
7
7
  require 'faraday'
8
8
  require 'keyword_init'
9
9
  require 'naught'
10
- require 'hashie'
11
10
 
12
11
  require 'artirix_cache_service'
13
12
 
@@ -40,7 +40,7 @@ module ArtirixDataModels
40
40
  end
41
41
 
42
42
  def treat_buckets(hash)
43
- with_buckets_list = deep_locate hash, FIND_BUCKETS
43
+ with_buckets_list = locate FIND_BUCKETS, hash
44
44
 
45
45
  with_buckets_list.each do |with_buckets|
46
46
  with_buckets.each do |name, value|
@@ -50,7 +50,7 @@ module ArtirixDataModels
50
50
  end
51
51
 
52
52
  def treat_values(hash)
53
- with_values_list = deep_locate hash, FIND_VALUE
53
+ with_values_list = locate FIND_VALUE, hash
54
54
 
55
55
  with_values_list.each do |with_values|
56
56
  with_values.each do |name, value|
@@ -60,7 +60,7 @@ module ArtirixDataModels
60
60
  end
61
61
 
62
62
  def treat_counts(hash)
63
- with_values_list = deep_locate hash, FIND_COUNTS
63
+ with_values_list = locate FIND_COUNTS, hash
64
64
  with_values_list.each do |with_values|
65
65
  with_values.each do |name, value|
66
66
  normalise_element(name, value)
@@ -120,12 +120,40 @@ module ArtirixDataModels
120
120
  end
121
121
 
122
122
  # aux
123
- def deep_locate(object, callable)
124
- Hashie::Extensions::DeepLocate.deep_locate(callable, object).deep_dup
123
+ def locate(callable, object)
124
+ self.class.locate(callable, object).deep_dup
125
125
  end
126
126
 
127
127
  def nested_aggs_from(raw_bucket)
128
128
  RawAggregationDataNormaliser.new(aggregations_factory, raw_bucket).normalise
129
129
  end
130
+
131
+ ###################################################
132
+ # from former Hashie implementation (up to 3.4.x) #
133
+ ###################################################
134
+
135
+ def self.locate(comparator, object, result = [])
136
+ if object.is_a?(::Enumerable)
137
+ if object.any? { |value| match_comparator?(value, comparator, object) }
138
+ result.push object
139
+ else # DO NOT LOOK DEEPER ONCE FOUND IF THE VALUE FOUND IS A HASH (this will prevent us from properly recognising nested aggregations)!
140
+ (object.respond_to?(:values) ? object.values : object.entries).each do |value|
141
+ locate(comparator, value, result)
142
+ end
143
+ end
144
+ end
145
+
146
+ result
147
+ end
148
+
149
+ def self.match_comparator?(value, comparator, object)
150
+ if object.is_a?(::Hash)
151
+ key, value = value
152
+ else
153
+ key = nil
154
+ end
155
+
156
+ comparator.call(key, value, object)
157
+ end
130
158
  end
131
- end
159
+ end
@@ -1,3 +1,3 @@
1
1
  module ArtirixDataModels
2
- VERSION = '1.0.0.beta2'
2
+ VERSION = '1.0.0.beta3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: artirix_data_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.beta2
4
+ version: 1.0.0.beta3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eduardo Turiño
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-25 00:00:00.000000000 Z
11
+ date: 2017-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -94,20 +94,6 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
- - !ruby/object:Gem::Dependency
98
- name: hashie
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - "~>"
102
- - !ruby/object:Gem::Version
103
- version: '3.4'
104
- type: :runtime
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - "~>"
109
- - !ruby/object:Gem::Version
110
- version: '3.4'
111
97
  - !ruby/object:Gem::Dependency
112
98
  name: artirix_cache_service
113
99
  requirement: !ruby/object:Gem::Requirement
@@ -326,7 +312,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
326
312
  version: 1.3.1
327
313
  requirements: []
328
314
  rubyforge_project:
329
- rubygems_version: 2.5.1
315
+ rubygems_version: 2.5.2
330
316
  signing_key:
331
317
  specification_version: 4
332
318
  summary: Data Models (read only model) and Data Layer connection lib