jsonize 0.3.0 → 0.4.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/README.md +40 -25
- data/Rakefile +7 -1
- data/jsonize.gemspec +5 -0
- data/lib/jsonize/cache_key.rb +15 -0
- data/lib/jsonize/extension/object.rb +13 -0
- data/lib/jsonize/extension.rb +5 -0
- data/lib/jsonize/version.rb +1 -1
- data/lib/jsonize.rb +128 -60
- metadata +76 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9b46410dfd7eba02b89ba410e780a426f26b68ba3374d85d7f293fa2d7aa9842
|
|
4
|
+
data.tar.gz: 8ba98ee8661491ea6b3657ef85f2342d54052fe3c3b814125ac0b80f2532a643
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6ad99c2157a0e6530c254bea9b5827a2c87b138c994982e16d809ace7c88a7f35737b91e1824fa0e47778c0d7e69af32c503af0f3df199ae62195644b300eb02
|
|
7
|
+
data.tar.gz: e9246d968f74e684e8c8ac24990a7aa1438efa83e566f9ca47c93ce1aca0f0c41f9f794b038fecd1985c277c08a61b3a89e362b6e3cf1ac2c4cf12617f457cc5
|
data/README.md
CHANGED
|
@@ -1,44 +1,59 @@
|
|
|
1
1
|
# Jsonize
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
Add this line to your application's Gemfile:
|
|
3
|
+
`jsonize(options = {})` converts an ActiveRecord record, relation, array, hash,
|
|
4
|
+
or ordinary Ruby value into JSON-compatible data. Hash keys become strings;
|
|
5
|
+
ActiveSupport converts ordinary dates and times. Model dates use ISO 8601;
|
|
6
|
+
model timestamps include the timezone so browser timers can parse them
|
|
7
|
+
consistently. Finite Float attributes, including
|
|
8
|
+
computed attributes, remain JSON numbers in records and relations.
|
|
10
9
|
|
|
11
10
|
```ruby
|
|
12
|
-
gem 'jsonize'
|
|
11
|
+
gem 'jsonize', git: 'https://codeberg.org/majioa/jsonize.git', ref: '<commit>'
|
|
13
12
|
```
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
```ruby
|
|
15
|
+
article.jsonize(only: [:id, :title])
|
|
16
|
+
Article.where(published: true).jsonize(only: [:id, :title])
|
|
17
|
+
{ items: [article], visible: false }.jsonize
|
|
18
|
+
Date.new(2026, 11, 8).jsonize # => '2026-11-08'
|
|
19
|
+
```
|
|
18
20
|
|
|
19
|
-
|
|
21
|
+
## Fields and external data
|
|
20
22
|
|
|
21
|
-
|
|
23
|
+
`only` selects fields; `except` excludes them. String and Symbol field names
|
|
24
|
+
are equivalent. Records exclude `created_at` and `updated_at` by default.
|
|
25
|
+
Use an array of hashes for nested field selections:
|
|
22
26
|
|
|
23
|
-
|
|
27
|
+
```ruby
|
|
28
|
+
{ items: [{ id: 1, secret: 'hidden' }] }.jsonize(only: [{ items: [:id] }])
|
|
29
|
+
# => {'items' => [{'id' => 1}]}
|
|
24
30
|
|
|
25
|
-
|
|
31
|
+
article.jsonize(externals: { calendar: 'julian' })
|
|
32
|
+
```
|
|
26
33
|
|
|
27
|
-
|
|
34
|
+
`externals` adds fields to a record representation. Computed SQL fields with
|
|
35
|
+
an `_` prefix are available without that prefix, such as `_title` as `title`.
|
|
36
|
+
Serialization preserves the supplied options and source collections.
|
|
28
37
|
|
|
29
|
-
|
|
38
|
+
## Caching
|
|
30
39
|
|
|
31
|
-
|
|
40
|
+
Record cache keys include the current attributes, SQL projection, and complete
|
|
41
|
+
serialization options, including `externals`. Relation cache keys include SQL
|
|
42
|
+
and serialization options. Repeated calls with the same data reuse the cache.
|
|
43
|
+
Plain hashes and arrays retain their own keys, shape, and current values.
|
|
32
44
|
|
|
33
|
-
|
|
45
|
+
New records, loaded relations, SQL containing `random()`, and options that
|
|
46
|
+
cannot be serialized for a cache key are processed directly. Records within
|
|
47
|
+
a relation can still use their own contextual cache.
|
|
48
|
+
To invalidate a representation, pass the same options:
|
|
34
49
|
|
|
35
|
-
|
|
50
|
+
```ruby
|
|
51
|
+
article.dejsonize(only: [:id, :title], externals: { calendar: 'julian' })
|
|
52
|
+
```
|
|
36
53
|
|
|
54
|
+
`as_json` remains a Rails compatibility adapter within the library.
|
|
55
|
+
Use `jsonize` as the application serialization API.
|
|
37
56
|
|
|
38
57
|
## License
|
|
39
58
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
## Code of Conduct
|
|
43
|
-
|
|
44
|
-
Everyone interacting in the Jsonize project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://codeberg.org/majioa/jsonize/blob/master/CODE_OF_CONDUCT.md).
|
|
59
|
+
[MIT](LICENSE.txt).
|
data/Rakefile
CHANGED
data/jsonize.gemspec
CHANGED
|
@@ -29,4 +29,9 @@ Gem::Specification.new do |spec|
|
|
|
29
29
|
spec.add_runtime_dependency('redisize')
|
|
30
30
|
spec.add_runtime_dependency('activerecord', '>= 4.2')
|
|
31
31
|
spec.add_development_dependency('pry')
|
|
32
|
+
spec.add_development_dependency('rails', '~> 7.0.8')
|
|
33
|
+
spec.add_development_dependency('cucumber', '~> 5.3')
|
|
34
|
+
spec.add_development_dependency('rspec-expectations', '~> 3.0')
|
|
35
|
+
spec.add_development_dependency('rspec-mocks', '~> 3.0')
|
|
36
|
+
spec.add_development_dependency('sqlite3', '~> 1.4')
|
|
32
37
|
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
require 'digest'
|
|
2
|
+
|
|
3
|
+
module Jsonize
|
|
4
|
+
# Разделяет версии представлений и не помещает исходные данные в имя ключа.
|
|
5
|
+
module CacheKey
|
|
6
|
+
# Строит отпечаток схемы и контекста; неподдерживаемые Marshal значения дают nil.
|
|
7
|
+
# @param value [Object] Параметры и данные, влияющие на представление.
|
|
8
|
+
# @return [String, nil] Версионный SHA256-ключ либо nil для обхода кеша.
|
|
9
|
+
def self.digest value
|
|
10
|
+
'jsonize/v3/' + Digest::SHA256.hexdigest(Marshal.dump(value))
|
|
11
|
+
rescue TypeError
|
|
12
|
+
nil
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require 'active_support/core_ext/object/json'
|
|
2
|
+
|
|
3
|
+
module Jsonize::Extension
|
|
4
|
+
# Адаптер обычных Ruby-значений к единому API jsonize.
|
|
5
|
+
module Object
|
|
6
|
+
# Преобразует число, дату и другие значения стандартным адаптером Rails.
|
|
7
|
+
# @param options [Hash] Параметры стандартной JSON-сериализации Rails.
|
|
8
|
+
# @return [Object] JSON-совместимое значение без дополнительного кеша.
|
|
9
|
+
def jsonize options = {}
|
|
10
|
+
as_json(options)
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
data/lib/jsonize/version.rb
CHANGED
data/lib/jsonize.rb
CHANGED
|
@@ -3,6 +3,8 @@ require 'redisize'
|
|
|
3
3
|
require "jsonize/version"
|
|
4
4
|
|
|
5
5
|
module Jsonize
|
|
6
|
+
autoload :CacheKey, 'jsonize/cache_key'
|
|
7
|
+
autoload :Extension, 'jsonize/extension'
|
|
6
8
|
DEFAULT_EXCEPT_ATTRS = [:created_at, :updated_at]
|
|
7
9
|
|
|
8
10
|
JSONIZE_ATTRS = {
|
|
@@ -14,7 +16,7 @@ module Jsonize
|
|
|
14
16
|
ActiveRecord: 'active_record'
|
|
15
17
|
}
|
|
16
18
|
|
|
17
|
-
JSON_TYPES = [String, Integer, TrueClass, FalseClass, NilClass, Hash, Array]
|
|
19
|
+
JSON_TYPES = [String, Integer, Float, TrueClass, FalseClass, NilClass, Hash, Array]
|
|
18
20
|
|
|
19
21
|
def default_except_attributes
|
|
20
22
|
DEFAULT_EXCEPT_ATTRS
|
|
@@ -57,22 +59,25 @@ module Jsonize
|
|
|
57
59
|
[props].flatten.reduce(nil) do |r, source|
|
|
58
60
|
case source
|
|
59
61
|
when UnboundMethod
|
|
60
|
-
r
|
|
62
|
+
r.nil? ?
|
|
61
63
|
begin
|
|
62
64
|
source.bind(flow)[]
|
|
63
|
-
rescue ActiveModel::MissingAttributeError, TypeError, NoMethodError
|
|
65
|
+
rescue ActiveModel::MissingAttributeError, TypeError, NoMethodError => e
|
|
64
66
|
rescue Exception => e
|
|
65
|
-
$stderr.puts("#{e.class}: #{e.message}")
|
|
66
|
-
|
|
67
|
-
end
|
|
67
|
+
$stderr.puts("#{e.class}[#{source}]: #{e.message}")
|
|
68
|
+
end : r
|
|
68
69
|
when Proc
|
|
69
|
-
r
|
|
70
|
+
r.nil? ? source[flow] : r
|
|
70
71
|
when Hash, ActiveRecord::Reflection::AbstractReflection
|
|
71
|
-
|
|
72
|
-
options[:only]
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
72
|
+
if r.nil?
|
|
73
|
+
o = !options[:only] ? options :
|
|
74
|
+
options[:only].is_a?(Hash) ? options.merge(only: options[:only][name]) :
|
|
75
|
+
options.merge(only: nil)
|
|
76
|
+
|
|
77
|
+
generate_relation(flow.respond_to?(name) ? flow.send(name) : nil, source, o)
|
|
78
|
+
else
|
|
79
|
+
r
|
|
80
|
+
end
|
|
76
81
|
when NilClass
|
|
77
82
|
r
|
|
78
83
|
else
|
|
@@ -84,16 +89,29 @@ module Jsonize
|
|
|
84
89
|
end
|
|
85
90
|
end
|
|
86
91
|
|
|
92
|
+
# Preserves JSON primitives and formats model dates/times as ISO 8601.
|
|
93
|
+
# Values with iso8601 use that representation; other objects retain to_s.
|
|
94
|
+
# @param value_in [Object] An ActiveRecord attribute or computed model value.
|
|
95
|
+
# @return [Object, String] The primitive value or its string representation.
|
|
87
96
|
def proceed_value value_in
|
|
88
|
-
(value_in.class.ancestors & JSON_TYPES).any?
|
|
97
|
+
return value_in if (value_in.class.ancestors & JSON_TYPES).any?
|
|
98
|
+
|
|
99
|
+
value_in.respond_to?(:iso8601) ? value_in.iso8601 : value_in.to_s
|
|
89
100
|
end
|
|
90
101
|
|
|
91
102
|
def prepare_attributes model, attrs
|
|
92
103
|
attrs.reduce({}) do |h, x|
|
|
93
104
|
if x.is_a?(Hash)
|
|
94
105
|
x.reduce(h) do |hh, (sub, subattrs)|
|
|
95
|
-
|
|
96
|
-
|
|
106
|
+
case subattrs
|
|
107
|
+
when Hash, Array
|
|
108
|
+
if submodel = model.reflect_on_association(sub)&.klass
|
|
109
|
+
collect_attributes(hh, model, sub, sub.to_sym, prepare_attributes(submodel, subattrs))
|
|
110
|
+
else
|
|
111
|
+
collect_attributes(hh, model, sub, sub.to_sym, nil)
|
|
112
|
+
end
|
|
113
|
+
when Symbol, String
|
|
114
|
+
collect_attributes(hh, model, subattrs.to_s, sub.to_sym, nil)
|
|
97
115
|
else
|
|
98
116
|
hh
|
|
99
117
|
end
|
|
@@ -108,23 +126,24 @@ module Jsonize
|
|
|
108
126
|
base = [ ->(this) { this.respond_to?(:read_attribute) ? this.read_attribute("_#{name}") : nil } ]
|
|
109
127
|
|
|
110
128
|
props =
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
129
|
+
unless value
|
|
130
|
+
[model.reflect_on_association(name),
|
|
131
|
+
model.instance_methods.include?(name.to_sym) ? model.instance_method(name.to_sym) : nil,
|
|
132
|
+
->(this) { this.is_a?(Hash) ? this[name] : nil },
|
|
133
|
+
(self.class == model ? self.attribute_names : model.attribute_names).include?(name.to_s) ?
|
|
134
|
+
->(this) { this.respond_to?(:read_attribute) ? this.read_attribute(name) :
|
|
135
|
+
this.respond_to?(name) ? this.send(name) : nil } : nil,
|
|
136
|
+
].compact
|
|
137
|
+
else
|
|
138
|
+
[value]
|
|
139
|
+
end
|
|
121
140
|
|
|
122
141
|
h.merge(key => base.concat(props))
|
|
123
142
|
end
|
|
124
143
|
|
|
125
144
|
def attibute_tree klass, options = {}
|
|
126
145
|
options[:only] ||
|
|
127
|
-
|
|
146
|
+
jsonize_attributes_except(self.class == klass ? self.attribute_names : klass.attribute_names,
|
|
128
147
|
options[:except] || default_except_attributes)
|
|
129
148
|
end
|
|
130
149
|
|
|
@@ -132,14 +151,12 @@ module Jsonize
|
|
|
132
151
|
jsonize_schemes[attr_tree] ||= prepare_attributes(klass, attr_tree)
|
|
133
152
|
end
|
|
134
153
|
|
|
154
|
+
# Исключает поля, не изменяя список атрибутов модели или входной массив.
|
|
155
|
+
# @param a_in [Array<String>] Имена доступных атрибутов.
|
|
156
|
+
# @param except_in [Array<String, Symbol>] Исключаемые имена полей.
|
|
157
|
+
# @return [Array<String>] Новый список доступных полей.
|
|
135
158
|
def jsonize_attributes_except a_in, except_in
|
|
136
|
-
except_in.
|
|
137
|
-
if res.include?(name)
|
|
138
|
-
res.delete(name)
|
|
139
|
-
end
|
|
140
|
-
|
|
141
|
-
res
|
|
142
|
-
end
|
|
159
|
+
a_in - except_in.map(&:to_s)
|
|
143
160
|
end
|
|
144
161
|
|
|
145
162
|
def jsonize_schemes
|
|
@@ -153,18 +170,31 @@ module Jsonize
|
|
|
153
170
|
@primary_key
|
|
154
171
|
end
|
|
155
172
|
|
|
173
|
+
# Сериализует запись с учётом схемы, параметров и текущей SQL-проекции.
|
|
174
|
+
# Для новой записи или некешируемых параметров строит результат напрямую.
|
|
175
|
+
# @param options [Hash] only/except, externals и контекст представления.
|
|
176
|
+
# @return [Hash] Представление записи со строковыми ключами.
|
|
156
177
|
def jsonize options = {}
|
|
157
178
|
attr_tree = attibute_tree(self.class, options)
|
|
179
|
+
scheme = CacheKey.digest([attr_tree, options, attributes])
|
|
180
|
+
attr_props = jsonize_scheme_for(self.class, attr_tree)
|
|
158
181
|
|
|
159
|
-
|
|
160
|
-
|
|
182
|
+
return generate_json(self, attr_props, options) if new_record? || scheme.nil?
|
|
183
|
+
|
|
184
|
+
redisize_json(scheme) do
|
|
161
185
|
generate_json(self, attr_props, options)
|
|
162
186
|
end
|
|
163
187
|
end
|
|
164
188
|
|
|
189
|
+
# Сбрасывает представление с той же схемой, параметрами и проекцией.
|
|
190
|
+
# Для некешируемых параметров возвращает nil без обращения к кешу.
|
|
191
|
+
# @param options [Hash] Параметры соответствующего вызова jsonize.
|
|
192
|
+
# @return [Object, nil] Результат постановки сброса в очередь либо nil.
|
|
165
193
|
def dejsonize options = {}
|
|
166
194
|
attr_tree = attibute_tree(self.class, options)
|
|
167
|
-
|
|
195
|
+
scheme = CacheKey.digest([attr_tree, options, attributes])
|
|
196
|
+
|
|
197
|
+
deredisize_json(scheme) unless scheme.nil?
|
|
168
198
|
end
|
|
169
199
|
|
|
170
200
|
def as_json options = {}
|
|
@@ -174,53 +204,90 @@ module Jsonize
|
|
|
174
204
|
end
|
|
175
205
|
|
|
176
206
|
module Collection
|
|
207
|
+
# Преобразует значения коллекции; кеширование записей выполняется их jsonize.
|
|
208
|
+
# @param context [Hash] Схема полей и параметры вложенных значений.
|
|
209
|
+
# @return [Hash, Array, Object] JSON-совместимое представление коллекции.
|
|
177
210
|
def jsonize context = {}
|
|
178
|
-
|
|
179
|
-
case self
|
|
180
|
-
when Hash
|
|
181
|
-
:redisize_hash
|
|
182
|
-
when Array
|
|
183
|
-
:redisize_array
|
|
184
|
-
end
|
|
185
|
-
|
|
186
|
-
send(method) do
|
|
187
|
-
as_pure_json(context)
|
|
188
|
-
end
|
|
211
|
+
as_pure_json(context)
|
|
189
212
|
end
|
|
190
213
|
|
|
214
|
+
# Передаёт вложенному ключу его only/except, сохраняя остальные параметры.
|
|
215
|
+
# @param context [Hash] Родительский контекст представления.
|
|
216
|
+
# @param key [Object] Ключ Hash; String и Symbol с одним именем равнозначны.
|
|
217
|
+
# @return [Hash] Новый контекст с вложенной схемой либо nil в полях без схемы.
|
|
191
218
|
def recontext context, key
|
|
192
|
-
|
|
193
|
-
|
|
219
|
+
context.merge(only: nested_jsonize_option(context[:only], key),
|
|
220
|
+
except: nested_jsonize_option(context[:except], key))
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
# Ищет схему вложенного ключа; без подходящего Hash возвращает nil.
|
|
224
|
+
# @param filter [Array, Hash, nil] Значение only или except.
|
|
225
|
+
# @param key [Object] Имя вложенного поля.
|
|
226
|
+
# @return [Object, nil] Схема найденного поля либо nil.
|
|
227
|
+
def nested_jsonize_option filter, key
|
|
228
|
+
[filter].flatten(1).each do |entry|
|
|
229
|
+
next unless entry.is_a?(Hash)
|
|
230
|
+
|
|
231
|
+
pair = entry.find { |field, _value| field.to_s == key.to_s }
|
|
194
232
|
|
|
195
|
-
|
|
233
|
+
return pair.last if pair
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
nil
|
|
196
237
|
end
|
|
197
238
|
|
|
239
|
+
# Обрабатывает Hash по ключам, Array по элементам; прочие Enumerable — адаптером Rails.
|
|
240
|
+
# @param context [Hash] only/except и вложенные схемы полей.
|
|
241
|
+
# @return [Hash, Array, Object] Новое представление без изменения исходных данных.
|
|
198
242
|
def as_pure_json context = {}
|
|
199
243
|
case self
|
|
200
244
|
when Hash
|
|
201
|
-
|
|
245
|
+
jsonize_fields(context).map do |key, value_in|
|
|
202
246
|
new_context = recontext(context, key)
|
|
203
|
-
|
|
204
|
-
value = value_in.respond_to?(:as_pure_json) ? value_in.as_pure_json(new_context) : value_in.as_json(new_context)
|
|
247
|
+
value = value_in.jsonize(new_context)
|
|
205
248
|
|
|
206
249
|
[key.to_s, value]
|
|
207
250
|
end.to_h
|
|
208
251
|
when Array
|
|
209
|
-
|
|
210
|
-
new_context = recontext(context, index.to_i)
|
|
211
|
-
|
|
212
|
-
value_in.respond_to?(:as_pure_json) ? value_in.as_pure_json(new_context) : value_in.as_json(new_context)
|
|
213
|
-
end
|
|
252
|
+
map { |value_in| value_in.jsonize(context) }
|
|
214
253
|
else
|
|
215
254
|
as_json(context)
|
|
216
255
|
end
|
|
217
256
|
end
|
|
257
|
+
|
|
258
|
+
# Выбирает поля Hash по only либо except; без фильтра возвращает исходный Hash.
|
|
259
|
+
# @param context [Hash] only имеет приоритет перед except; имена String/Symbol равнозначны.
|
|
260
|
+
# @return [Hash] Выбранные поля без изменения исходного Hash или схемы.
|
|
261
|
+
def jsonize_fields context
|
|
262
|
+
filter = context[:only] || context[:except]
|
|
263
|
+
|
|
264
|
+
return self unless filter
|
|
265
|
+
|
|
266
|
+
fields = [filter].flatten(1).flat_map { |entry| entry.is_a?(Hash) ? entry.keys : entry }.map(&:to_s)
|
|
267
|
+
|
|
268
|
+
select do |key, _value|
|
|
269
|
+
present = fields.include?(key.to_s)
|
|
270
|
+
|
|
271
|
+
context[:only] ? present : !present
|
|
272
|
+
end
|
|
273
|
+
end
|
|
218
274
|
end
|
|
219
275
|
|
|
220
276
|
module Relation
|
|
277
|
+
# Сериализует выборку с кешем по SQL и полному контексту представления.
|
|
278
|
+
# Загруженная выборка, random() или некешируемый контекст обрабатываются напрямую.
|
|
279
|
+
# @param context [Hash] only/except, externals и прочие параметры представления.
|
|
280
|
+
# @return [Array<Hash>] Представления записей в порядке выборки.
|
|
221
281
|
def jsonize context = {}
|
|
222
|
-
|
|
223
|
-
|
|
282
|
+
sql = to_sql
|
|
283
|
+
scheme = CacheKey.digest(context)
|
|
284
|
+
|
|
285
|
+
return to_a.jsonize(context) if loaded? || sql.match(/\brandom\s*\(/i) || scheme.nil?
|
|
286
|
+
|
|
287
|
+
key = ['sql', name, primary_key, scheme, sql]
|
|
288
|
+
|
|
289
|
+
redisize_by_key(key) do
|
|
290
|
+
to_a.jsonize(context)
|
|
224
291
|
end
|
|
225
292
|
end
|
|
226
293
|
|
|
@@ -250,5 +317,6 @@ module Jsonize
|
|
|
250
317
|
end
|
|
251
318
|
end
|
|
252
319
|
|
|
320
|
+
::Object.include(Jsonize::Extension::Object)
|
|
253
321
|
self.detect_orm
|
|
254
322
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: jsonize
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Pavel «Malo» Skrylev
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-11-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: redisize
|
|
@@ -52,6 +52,76 @@ dependencies:
|
|
|
52
52
|
- - ">="
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
54
|
version: '0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: rails
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - "~>"
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: 7.0.8
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - "~>"
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: 7.0.8
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: cucumber
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - "~>"
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '5.3'
|
|
76
|
+
type: :development
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - "~>"
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '5.3'
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: rspec-expectations
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - "~>"
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: '3.0'
|
|
90
|
+
type: :development
|
|
91
|
+
prerelease: false
|
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - "~>"
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: '3.0'
|
|
97
|
+
- !ruby/object:Gem::Dependency
|
|
98
|
+
name: rspec-mocks
|
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
|
100
|
+
requirements:
|
|
101
|
+
- - "~>"
|
|
102
|
+
- !ruby/object:Gem::Version
|
|
103
|
+
version: '3.0'
|
|
104
|
+
type: :development
|
|
105
|
+
prerelease: false
|
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
107
|
+
requirements:
|
|
108
|
+
- - "~>"
|
|
109
|
+
- !ruby/object:Gem::Version
|
|
110
|
+
version: '3.0'
|
|
111
|
+
- !ruby/object:Gem::Dependency
|
|
112
|
+
name: sqlite3
|
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
|
114
|
+
requirements:
|
|
115
|
+
- - "~>"
|
|
116
|
+
- !ruby/object:Gem::Version
|
|
117
|
+
version: '1.4'
|
|
118
|
+
type: :development
|
|
119
|
+
prerelease: false
|
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
121
|
+
requirements:
|
|
122
|
+
- - "~>"
|
|
123
|
+
- !ruby/object:Gem::Version
|
|
124
|
+
version: '1.4'
|
|
55
125
|
description: Act as as_json for active record model or as a jsonize using the cacheable
|
|
56
126
|
redisize
|
|
57
127
|
email:
|
|
@@ -70,6 +140,9 @@ files:
|
|
|
70
140
|
- bin/setup
|
|
71
141
|
- jsonize.gemspec
|
|
72
142
|
- lib/jsonize.rb
|
|
143
|
+
- lib/jsonize/cache_key.rb
|
|
144
|
+
- lib/jsonize/extension.rb
|
|
145
|
+
- lib/jsonize/extension/object.rb
|
|
73
146
|
- lib/jsonize/orm/active_record.rb
|
|
74
147
|
- lib/jsonize/version.rb
|
|
75
148
|
homepage: https://codeberg.org/majioa/jsonize
|
|
@@ -95,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
95
168
|
- !ruby/object:Gem::Version
|
|
96
169
|
version: '0'
|
|
97
170
|
requirements: []
|
|
98
|
-
rubygems_version: 3.
|
|
171
|
+
rubygems_version: 3.5.22
|
|
99
172
|
signing_key:
|
|
100
173
|
specification_version: 4
|
|
101
174
|
summary: Act as as_json for active record model or as a jsonize
|