stretchy-model 0.3.0 → 0.5.0
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 +4 -4
- data/.rspec +1 -1
- data/README.md +40 -94
- data/Rakefile +92 -0
- data/lib/stretchy/associations.rb +155 -15
- data/lib/stretchy/attributes/transformers/keyword_transformer.rb +85 -0
- data/lib/stretchy/attributes/type/array.rb +15 -0
- data/lib/stretchy/attributes/type/hash.rb +17 -0
- data/lib/stretchy/attributes/type/keyword.rb +11 -0
- data/lib/stretchy/attributes/type/text.rb +12 -0
- data/lib/stretchy/attributes.rb +30 -0
- data/lib/stretchy/common.rb +2 -3
- data/lib/stretchy/delegation/gateway_delegation.rb +7 -1
- data/lib/stretchy/model/serialization.rb +1 -0
- data/lib/stretchy/querying.rb +6 -5
- data/lib/stretchy/record.rb +8 -9
- data/lib/stretchy/relation.rb +11 -17
- data/lib/stretchy/relations/aggregation_methods.rb +758 -0
- data/lib/stretchy/relations/finder_methods.rb +21 -3
- data/lib/stretchy/relations/merger.rb +11 -7
- data/lib/stretchy/relations/query_builder.rb +48 -11
- data/lib/stretchy/relations/query_methods.rb +76 -38
- data/lib/stretchy/shared_scopes.rb +1 -1
- data/lib/stretchy/utils.rb +21 -0
- data/lib/stretchy/version.rb +1 -3
- data/lib/stretchy.rb +21 -11
- data/lib/stretchy_model.rb +9 -0
- metadata +39 -5
- data/lib/active_model/type/array.rb +0 -13
- data/lib/active_model/type/hash.rb +0 -15
@@ -9,7 +9,15 @@ module Stretchy
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def first!
|
12
|
-
|
12
|
+
spawned = spawn
|
13
|
+
if spawned.order_values.length.zero?
|
14
|
+
spawn.sort(Hash[default_sort_key, :asc]).spawn.size(1)
|
15
|
+
elsif spawned.order_values.length >= 1
|
16
|
+
first_order_value = spawned.order_values.shift
|
17
|
+
new_direction = Hash[first_order_value.keys.first, :asc]
|
18
|
+
spawned.order_values.unshift(new_direction)
|
19
|
+
spawned.size(1)
|
20
|
+
end
|
13
21
|
self
|
14
22
|
end
|
15
23
|
|
@@ -19,7 +27,15 @@ module Stretchy
|
|
19
27
|
end
|
20
28
|
|
21
29
|
def last!
|
22
|
-
|
30
|
+
spawned = spawn
|
31
|
+
if spawned.order_values.length.zero?
|
32
|
+
spawn.sort(Hash[default_sort_key, :desc]).spawn.size(1)
|
33
|
+
elsif spawned.order_values.length >= 1
|
34
|
+
first_order_value = spawned.order_values.shift
|
35
|
+
new_direction = Hash[first_order_value.keys.first, :desc]
|
36
|
+
spawned.order_values.unshift(new_direction)
|
37
|
+
spawned.size(1)
|
38
|
+
end
|
23
39
|
self
|
24
40
|
end
|
25
41
|
|
@@ -31,7 +47,9 @@ module Stretchy
|
|
31
47
|
def count!
|
32
48
|
@values[:count] = true
|
33
49
|
@values.delete(:size)
|
34
|
-
spawn
|
50
|
+
spawned = spawn
|
51
|
+
spawned.order_values.clear
|
52
|
+
spawned.results
|
35
53
|
end
|
36
54
|
|
37
55
|
end
|
@@ -7,8 +7,12 @@ module Stretchy
|
|
7
7
|
class HashMerger # :nodoc:
|
8
8
|
attr_reader :relation, :hash
|
9
9
|
|
10
|
+
VALUE_METHODS = Stretchy::Relations::QueryMethods::MULTI_VALUE_METHODS.concat(
|
11
|
+
Stretchy::Relations::QueryMethods::SINGLE_VALUE_METHODS
|
12
|
+
)
|
13
|
+
|
10
14
|
def initialize(relation, hash)
|
11
|
-
hash.assert_valid_keys(*
|
15
|
+
hash.assert_valid_keys(*VALUE_METHODS)
|
12
16
|
|
13
17
|
@relation = relation
|
14
18
|
@hash = hash
|
@@ -50,7 +54,7 @@ module Stretchy
|
|
50
54
|
@other = other
|
51
55
|
end
|
52
56
|
|
53
|
-
NORMAL_VALUES = [:where, :first, :last, :
|
57
|
+
NORMAL_VALUES = [:where, :first, :last, :filter_query]
|
54
58
|
|
55
59
|
def normal_values
|
56
60
|
NORMAL_VALUES
|
@@ -67,7 +71,7 @@ module Stretchy
|
|
67
71
|
unless value.nil? || (value.blank? && false != value)
|
68
72
|
if name == :select
|
69
73
|
relation._select!(*value)
|
70
|
-
elsif name == :
|
74
|
+
elsif name == :filter_query
|
71
75
|
values.each do |v|
|
72
76
|
relation.send("#{name}!", v.first, v.last)
|
73
77
|
end
|
@@ -114,19 +118,19 @@ module Stretchy
|
|
114
118
|
lhs_wheres = relation.where_values
|
115
119
|
rhs_wheres = values[:where] || []
|
116
120
|
|
117
|
-
lhs_filters = relation.
|
118
|
-
rhs_filters = values[:
|
121
|
+
lhs_filters = relation.filter_query_values
|
122
|
+
rhs_filters = values[:filter_query] || []
|
119
123
|
|
120
124
|
removed, kept = partition_overwrites(lhs_wheres, rhs_wheres)
|
121
125
|
|
122
126
|
where_values = kept + rhs_wheres
|
123
127
|
|
124
128
|
filters_removed, filters_kept = partition_overwrites(lhs_wheres, rhs_wheres)
|
125
|
-
|
129
|
+
filter_query_values = rhs_filters
|
126
130
|
|
127
131
|
|
128
132
|
relation.where_values = where_values.empty? ? nil : where_values
|
129
|
-
relation.
|
133
|
+
relation.filter_query_values = filter_query_values.empty? ? nil : filter_query_values
|
130
134
|
|
131
135
|
if values[:reordering]
|
132
136
|
# override any order specified in the original relation
|
@@ -2,9 +2,10 @@ module Stretchy
|
|
2
2
|
module Relations
|
3
3
|
class QueryBuilder
|
4
4
|
|
5
|
-
attr_reader :structure, :values
|
5
|
+
attr_reader :structure, :values, :attribute_types
|
6
6
|
|
7
|
-
def initialize(values)
|
7
|
+
def initialize(values, attribute_types = nil)
|
8
|
+
@attribute_types = attribute_types
|
8
9
|
@structure = Jbuilder.new ignore_nil: true
|
9
10
|
@values = values
|
10
11
|
end
|
@@ -14,7 +15,7 @@ module Stretchy
|
|
14
15
|
end
|
15
16
|
|
16
17
|
def filters
|
17
|
-
values[:
|
18
|
+
values[:filter_query]
|
18
19
|
end
|
19
20
|
|
20
21
|
def or_filters
|
@@ -37,6 +38,10 @@ module Stretchy
|
|
37
38
|
@shoulds ||= compact_where(values[:should])
|
38
39
|
end
|
39
40
|
|
41
|
+
def regexes
|
42
|
+
@regexes ||= values[:regexp]
|
43
|
+
end
|
44
|
+
|
40
45
|
def fields
|
41
46
|
values[:field]
|
42
47
|
end
|
@@ -58,7 +63,7 @@ module Stretchy
|
|
58
63
|
end
|
59
64
|
|
60
65
|
def query_filters
|
61
|
-
values[:
|
66
|
+
values[:filter_query]
|
62
67
|
end
|
63
68
|
|
64
69
|
def search_options
|
@@ -87,7 +92,7 @@ module Stretchy
|
|
87
92
|
private
|
88
93
|
|
89
94
|
def missing_bool_query?
|
90
|
-
query.nil? && must_nots.nil? && shoulds.nil?
|
95
|
+
query.nil? && must_nots.nil? && shoulds.nil? && regexes.nil?
|
91
96
|
end
|
92
97
|
|
93
98
|
def missing_query_string?
|
@@ -101,7 +106,12 @@ module Stretchy
|
|
101
106
|
def build_query
|
102
107
|
return if missing_bool_query? && missing_query_string? && missing_query_filter?
|
103
108
|
structure.query do
|
109
|
+
structure.regexp do
|
110
|
+
build_regexp unless regexes.nil?
|
111
|
+
end
|
112
|
+
|
104
113
|
structure.bool do
|
114
|
+
|
105
115
|
structure.must query unless missing_bool_query?
|
106
116
|
structure.must_not must_nots unless must_nots.nil?
|
107
117
|
structure.set! :should, shoulds unless shoulds.nil?
|
@@ -119,6 +129,14 @@ module Stretchy
|
|
119
129
|
end.with_indifferent_access
|
120
130
|
end
|
121
131
|
|
132
|
+
def build_regexp
|
133
|
+
regexes.each do |args|
|
134
|
+
target_field = args.first.keys.first
|
135
|
+
value_field = args.first.values.first
|
136
|
+
structure.set! target_field, args.last.merge(value: value_field)
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
122
140
|
def build_filtered_query
|
123
141
|
structure.filter do
|
124
142
|
structure.or do
|
@@ -149,14 +167,20 @@ module Stretchy
|
|
149
167
|
end
|
150
168
|
|
151
169
|
def build_sort
|
152
|
-
structure.sort sort.
|
170
|
+
structure.sort sort.map { |arg| keyword_transformer.transform(arg) }.flatten
|
153
171
|
end
|
154
172
|
|
155
173
|
def build_highlights
|
156
174
|
structure.highlight do
|
157
175
|
structure.fields do
|
158
176
|
highlights.each do |highlight|
|
159
|
-
|
177
|
+
if highlight.is_a?(String) || highlight.is_a?(Symbol)
|
178
|
+
structure.set! highlight, {}
|
179
|
+
elsif highlight.is_a?(Hash)
|
180
|
+
highlight.each_pair do |k,v|
|
181
|
+
structure.set! k, v
|
182
|
+
end
|
183
|
+
end
|
160
184
|
end
|
161
185
|
end
|
162
186
|
end
|
@@ -165,7 +189,7 @@ module Stretchy
|
|
165
189
|
def build_aggregations
|
166
190
|
structure.aggregations do
|
167
191
|
aggregations.each do |agg|
|
168
|
-
structure.set! agg[:name], aggregation(agg[:name], agg[:args])
|
192
|
+
structure.set! agg[:name], aggregation(agg[:name], keyword_transformer.transform(agg[:args], :name))
|
169
193
|
end
|
170
194
|
end
|
171
195
|
end
|
@@ -199,13 +223,23 @@ module Stretchy
|
|
199
223
|
def as_must(q)
|
200
224
|
_must = []
|
201
225
|
q.each do |arg|
|
202
|
-
|
203
|
-
|
204
|
-
|
226
|
+
case arg
|
227
|
+
when Hash
|
228
|
+
arg = keyword_transformer.transform(arg)
|
229
|
+
arg.each_pair do |k,v|
|
230
|
+
# If v is an array, we build a terms query otherwise a term query
|
231
|
+
_must << (v.is_a?(Array) ? {terms: Hash[k,v]} : {term: Hash[k,v]})
|
232
|
+
end
|
233
|
+
when String
|
234
|
+
_must << {term: Hash[[arg.split(/:/).collect(&:strip)]]}
|
235
|
+
when Array
|
236
|
+
_must << arg.first
|
237
|
+
end
|
205
238
|
end
|
206
239
|
_must.length == 1 ? _must.first : _must
|
207
240
|
end
|
208
241
|
|
242
|
+
|
209
243
|
def as_query_string(q)
|
210
244
|
_and = []
|
211
245
|
|
@@ -260,6 +294,9 @@ module Stretchy
|
|
260
294
|
end
|
261
295
|
end
|
262
296
|
|
297
|
+
def keyword_transformer
|
298
|
+
@keyword_transformer ||= Stretchy::Attributes::Transformers::KeywordTransformer.new(@attribute_types)
|
299
|
+
end
|
263
300
|
end
|
264
301
|
end
|
265
302
|
end
|
@@ -15,10 +15,11 @@ module Stretchy
|
|
15
15
|
:query_string,
|
16
16
|
:aggregation,
|
17
17
|
:search_option,
|
18
|
-
:
|
18
|
+
:filter_query,
|
19
19
|
:or_filter,
|
20
20
|
:extending,
|
21
|
-
:skip_callbacks
|
21
|
+
:skip_callbacks,
|
22
|
+
:regexp
|
22
23
|
]
|
23
24
|
|
24
25
|
SINGLE_VALUE_METHODS = [:size]
|
@@ -173,6 +174,16 @@ module Stretchy
|
|
173
174
|
# }
|
174
175
|
# }
|
175
176
|
#
|
177
|
+
# .where acts as a convienence method for adding conditions to the query. It can also be used to add
|
178
|
+
# range , regex, terms, and id queries through shorthand parameters.
|
179
|
+
#
|
180
|
+
# @example
|
181
|
+
# Model.where(price: {gte: 10, lte: 20})
|
182
|
+
# Model.where(age: 19..33)
|
183
|
+
# Model.where(color: /gr(a|e)y/)
|
184
|
+
# Model.where(id: [10, 22, 18])
|
185
|
+
# Model.where(names: ['John', 'Jane'])
|
186
|
+
#
|
176
187
|
# @return [ActiveRecord::Relation, WhereChain] a new relation, which reflects the conditions, or a WhereChain if opts is :chain
|
177
188
|
# @see #must
|
178
189
|
def where(opts = :chain, *rest)
|
@@ -181,7 +192,28 @@ module Stretchy
|
|
181
192
|
elsif opts.blank?
|
182
193
|
self
|
183
194
|
else
|
184
|
-
|
195
|
+
opts.each do |key, value|
|
196
|
+
case value
|
197
|
+
when Range
|
198
|
+
between(value, key)
|
199
|
+
when Hash
|
200
|
+
filter_query(:range, key => value) if value.keys.any? { |k| [:gte, :lte, :gt, :lt].include?(k) }
|
201
|
+
when Regexp
|
202
|
+
regexp(Hash[key, value])
|
203
|
+
when Array
|
204
|
+
# handle ID queries
|
205
|
+
# if [:id, :_id].include?(key)
|
206
|
+
|
207
|
+
# else
|
208
|
+
spawn.where!(opts, *rest)
|
209
|
+
# end
|
210
|
+
else
|
211
|
+
spawn.where!(opts, *rest)
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
self
|
216
|
+
|
185
217
|
end
|
186
218
|
end
|
187
219
|
|
@@ -199,6 +231,38 @@ module Stretchy
|
|
199
231
|
# @see #where
|
200
232
|
alias :must :where
|
201
233
|
|
234
|
+
# Adds a regexp condition to the query.
|
235
|
+
#
|
236
|
+
# @param field [Hash] the field to filter by and the Regexp to match
|
237
|
+
# @param opts [Hash] additional options for the regexp query
|
238
|
+
# - :flags [String] the flags to use for the regexp query (e.g. 'ALL')
|
239
|
+
# - :use_keyword [Boolean] whether to use the .keyword field for the regexp query. Default: true
|
240
|
+
# - :case_insensitive [Boolean] whether to use case insensitive matching. If the regexp has ignore case flag `/regex/i`, this is automatically set to true
|
241
|
+
# - :max_determinized_states [Integer] the maximum number of states that the regexp query can produce
|
242
|
+
# - :rewrite [String] the rewrite method to use for the regexp query
|
243
|
+
#
|
244
|
+
#
|
245
|
+
# @example
|
246
|
+
# Model.regexp(:name, /john|jane/)
|
247
|
+
# Model.regexp(:name, /john|jane/i)
|
248
|
+
# Model.regexp(:name, /john|jane/i, flags: 'ALL')
|
249
|
+
#
|
250
|
+
# @return [Stretchy::Relation] a new relation, which reflects the regexp condition
|
251
|
+
# @see #where
|
252
|
+
def regexp(args)
|
253
|
+
spawn.regexp!(args)
|
254
|
+
end
|
255
|
+
|
256
|
+
def regexp!(args) # :nodoc:
|
257
|
+
args = args.to_a
|
258
|
+
target_field, regex = args.shift
|
259
|
+
opts = args.to_h
|
260
|
+
opts.reverse_merge!(use_keyword: true)
|
261
|
+
target_field = "#{target_field}.keyword" if opts.delete(:use_keyword)
|
262
|
+
opts.merge!(case_insensitive: true) if regex.casefold?
|
263
|
+
self.regexp_values += [[Hash[target_field, regex.source], opts]]
|
264
|
+
self
|
265
|
+
end
|
202
266
|
|
203
267
|
|
204
268
|
|
@@ -308,7 +372,7 @@ module Stretchy
|
|
308
372
|
|
309
373
|
|
310
374
|
|
311
|
-
# @deprecated in elasticsearch 7.x+ use {#
|
375
|
+
# @deprecated in elasticsearch 7.x+ use {#filter_query} instead
|
312
376
|
def or_filter(name, options = {}, &block)
|
313
377
|
spawn.or_filter!(name, options, &block)
|
314
378
|
end
|
@@ -322,53 +386,27 @@ module Stretchy
|
|
322
386
|
#
|
323
387
|
# This method supports all filters supported by Elasticsearch.
|
324
388
|
#
|
325
|
-
# @overload
|
389
|
+
# @overload filter_query(type, opts)
|
326
390
|
# @param type [Symbol] the type of filter to add (:range, :term, etc.)
|
327
391
|
# @param opts [Hash] a hash containing the attribute and value to filter by
|
328
392
|
#
|
329
393
|
# @example
|
330
|
-
# Model.
|
331
|
-
# Model.
|
394
|
+
# Model.filter_query(:range, age: {gte: 30})
|
395
|
+
# Model.filter_query(:term, color: :blue)
|
332
396
|
#
|
333
397
|
# @return [Stretchy::Relation] a new relation, which reflects the filter
|
334
|
-
def
|
335
|
-
spawn.
|
398
|
+
def filter_query(name, options = {}, &block)
|
399
|
+
spawn.filter_query!(name, options, &block)
|
336
400
|
end
|
337
401
|
|
338
|
-
def
|
339
|
-
self.
|
402
|
+
def filter_query!(name, options = {}, &block) # :nodoc:
|
403
|
+
self.filter_query_values += [{name: name, args: options}]
|
340
404
|
self
|
341
405
|
end
|
342
406
|
|
343
407
|
|
344
408
|
|
345
|
-
# Adds an aggregation to the query.
|
346
|
-
#
|
347
|
-
# @param name [Symbol, String] the name of the aggregation
|
348
|
-
# @param options [Hash] a hash of options for the aggregation
|
349
|
-
# @param block [Proc] an optional block to further configure the aggregation
|
350
|
-
#
|
351
|
-
# @example
|
352
|
-
# Model.aggregation(:avg_price, field: :price)
|
353
|
-
# Model.aggregation(:price_ranges) do
|
354
|
-
# range field: :price, ranges: [{to: 100}, {from: 100, to: 200}, {from: 200}]
|
355
|
-
# end
|
356
|
-
#
|
357
|
-
# Aggregation results are available in the `aggregations` method of the results under name provided in the aggregation.
|
358
|
-
#
|
359
|
-
# @example
|
360
|
-
# results = Model.where(color: :blue).aggregation(:avg_price, field: :price)
|
361
|
-
# results.aggregations.avg_price
|
362
|
-
#
|
363
|
-
# @return [Stretchy::Relation] a new relation
|
364
|
-
def aggregation(name, options = {}, &block)
|
365
|
-
spawn.aggregation!(name, options, &block)
|
366
|
-
end
|
367
409
|
|
368
|
-
def aggregation!(name, options = {}, &block) # :nodoc:
|
369
|
-
self.aggregation_values += [{name: name, args: assume_keyword_field(options)}]
|
370
|
-
self
|
371
|
-
end
|
372
410
|
|
373
411
|
|
374
412
|
|
@@ -430,7 +468,7 @@ module Stretchy
|
|
430
468
|
#
|
431
469
|
# @return [ActiveRecord::Relation] a new relation, which reflects the exists filter
|
432
470
|
def has_field(field)
|
433
|
-
spawn.
|
471
|
+
spawn.filter_query(:exists, {field: field})
|
434
472
|
end
|
435
473
|
|
436
474
|
|
@@ -4,7 +4,7 @@ module Stretchy
|
|
4
4
|
|
5
5
|
included do
|
6
6
|
|
7
|
-
scope :between,
|
7
|
+
scope :between, ->(range, range_field = "created_at") { filter_query(:range, range_field => {gte: range.begin, lte: range.end}) }
|
8
8
|
scope :using_time_based_indices, lambda { |range| search_options(index: time_based_indices(range)) }
|
9
9
|
|
10
10
|
end
|
data/lib/stretchy/utils.rb
CHANGED
@@ -2,6 +2,27 @@ module Stretchy
|
|
2
2
|
module Utils
|
3
3
|
extend ActiveSupport::Concern
|
4
4
|
|
5
|
+
concerning :ConsoleMethods do
|
6
|
+
def reload!
|
7
|
+
Stretchy.loader.reload
|
8
|
+
end
|
9
|
+
|
10
|
+
def banner
|
11
|
+
banner = <<~BANNER
|
12
|
+
|
13
|
+
d8b
|
14
|
+
d8P d8P ?88
|
15
|
+
d888888P d888888P 88b
|
16
|
+
.d888b, ?88' 88bd88b d8888b ?88' d8888b 888888b ?88 d8P
|
17
|
+
?8b, 88P 88P' `d8b_,dP 88P d8P' `P 88P `?8bd88 88
|
18
|
+
`?8b 88b d88 88b 88b 88b d88 88P?8( d88
|
19
|
+
`?888P' `?8b d88' `?888P' `?8b `?888P'd88' 88b`?88P'?8b
|
20
|
+
)88
|
21
|
+
,d8P
|
22
|
+
`?888P'
|
23
|
+
BANNER
|
24
|
+
end
|
25
|
+
end
|
5
26
|
|
6
27
|
def self.to_curl(klass, arguments = {}, end_point = "_search")
|
7
28
|
host = klass.gateway.client.transport.transport.hosts&.first || klass.gateway.client.transport.transport.options[:url]
|
data/lib/stretchy/version.rb
CHANGED
data/lib/stretchy.rb
CHANGED
@@ -7,16 +7,29 @@ require 'elasticsearch/model'
|
|
7
7
|
require 'elasticsearch/persistence'
|
8
8
|
require 'active_model'
|
9
9
|
require 'active_support/all'
|
10
|
-
require 'active_model/type/array'
|
11
|
-
require 'active_model/type/hash'
|
12
|
-
|
13
|
-
ActiveModel::Type.register(:array, ActiveModel::Type::Array)
|
14
|
-
ActiveModel::Type.register(:hash, ActiveModel::Type::Hash)
|
15
10
|
|
16
11
|
require_relative "stretchy/version"
|
17
12
|
require_relative "rails/instrumentation/railtie" if defined?(Rails)
|
18
13
|
|
14
|
+
|
15
|
+
|
19
16
|
module Stretchy
|
17
|
+
|
18
|
+
def self.loader
|
19
|
+
@loader ||= begin
|
20
|
+
loader = Zeitwerk::Loader.new
|
21
|
+
loader.tag = File.basename(__FILE__, ".rb")
|
22
|
+
loader.inflector = Zeitwerk::GemInflector.new(__FILE__)
|
23
|
+
loader.push_dir(__dir__)
|
24
|
+
loader
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.boot!
|
29
|
+
loader.setup
|
30
|
+
Stretchy::Attributes.register!
|
31
|
+
end
|
32
|
+
|
20
33
|
module Errors
|
21
34
|
class QueryOptionMissing < StandardError; end
|
22
35
|
end
|
@@ -61,12 +74,9 @@ module Stretchy
|
|
61
74
|
end
|
62
75
|
end
|
63
76
|
|
64
|
-
end
|
65
77
|
|
78
|
+
end
|
66
79
|
|
80
|
+
Stretchy.loader.enable_reloading if defined?(Rails) && Rails.env.development? || ENV['RACK_ENV'] == 'development'
|
81
|
+
Stretchy.boot!
|
67
82
|
|
68
|
-
loader = Zeitwerk::Loader.new
|
69
|
-
loader.tag = File.basename(__FILE__, ".rb")
|
70
|
-
loader.inflector = Zeitwerk::GemInflector.new(__FILE__)
|
71
|
-
loader.push_dir(__dir__)
|
72
|
-
loader.setup
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stretchy-model
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Spencer Markowski
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-03-
|
11
|
+
date: 2024-03-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: zeitwerk
|
@@ -178,6 +178,34 @@ dependencies:
|
|
178
178
|
- - "~>"
|
179
179
|
- !ruby/object:Gem::Version
|
180
180
|
version: '3.0'
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: octokit
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - "~>"
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '4.20'
|
188
|
+
type: :development
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - "~>"
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '4.20'
|
195
|
+
- !ruby/object:Gem::Dependency
|
196
|
+
name: versionomy
|
197
|
+
requirement: !ruby/object:Gem::Requirement
|
198
|
+
requirements:
|
199
|
+
- - "~>"
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
version: 0.5.0
|
202
|
+
type: :development
|
203
|
+
prerelease: false
|
204
|
+
version_requirements: !ruby/object:Gem::Requirement
|
205
|
+
requirements:
|
206
|
+
- - "~>"
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: 0.5.0
|
181
209
|
description: Provides a familiar ActiveRecord-like interface for working with Elasticsearch
|
182
210
|
email:
|
183
211
|
- spencer.markowski@theablefew.com
|
@@ -196,14 +224,18 @@ files:
|
|
196
224
|
- containers/Dockerfile.elasticsearch
|
197
225
|
- containers/Dockerfile.opensearch
|
198
226
|
- docker-compose.yml
|
199
|
-
- lib/active_model/type/array.rb
|
200
|
-
- lib/active_model/type/hash.rb
|
201
227
|
- lib/rails/instrumentation/publishers.rb
|
202
228
|
- lib/rails/instrumentation/railtie.rb
|
203
229
|
- lib/stretchy.rb
|
204
230
|
- lib/stretchy/associations.rb
|
205
231
|
- lib/stretchy/associations/associated_validator.rb
|
206
232
|
- lib/stretchy/associations/elastic_relation.rb
|
233
|
+
- lib/stretchy/attributes.rb
|
234
|
+
- lib/stretchy/attributes/transformers/keyword_transformer.rb
|
235
|
+
- lib/stretchy/attributes/type/array.rb
|
236
|
+
- lib/stretchy/attributes/type/hash.rb
|
237
|
+
- lib/stretchy/attributes/type/keyword.rb
|
238
|
+
- lib/stretchy/attributes/type/text.rb
|
207
239
|
- lib/stretchy/common.rb
|
208
240
|
- lib/stretchy/delegation/delegate_cache.rb
|
209
241
|
- lib/stretchy/delegation/gateway_delegation.rb
|
@@ -217,6 +249,7 @@ files:
|
|
217
249
|
- lib/stretchy/record.rb
|
218
250
|
- lib/stretchy/refreshable.rb
|
219
251
|
- lib/stretchy/relation.rb
|
252
|
+
- lib/stretchy/relations/aggregation_methods.rb
|
220
253
|
- lib/stretchy/relations/finder_methods.rb
|
221
254
|
- lib/stretchy/relations/merger.rb
|
222
255
|
- lib/stretchy/relations/query_builder.rb
|
@@ -231,6 +264,7 @@ files:
|
|
231
264
|
- lib/stretchy/shared_scopes.rb
|
232
265
|
- lib/stretchy/utils.rb
|
233
266
|
- lib/stretchy/version.rb
|
267
|
+
- lib/stretchy_model.rb
|
234
268
|
- sig/stretchy.rbs
|
235
269
|
- stretchy-model/lib/stretchy-model.rb
|
236
270
|
- stretchy.logo.png
|
@@ -257,7 +291,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
257
291
|
- !ruby/object:Gem::Version
|
258
292
|
version: '0'
|
259
293
|
requirements: []
|
260
|
-
rubygems_version: 3.3
|
294
|
+
rubygems_version: 3.5.3
|
261
295
|
signing_key:
|
262
296
|
specification_version: 4
|
263
297
|
summary: Rails ORM for Elasticsearch
|