aspose_cells_cloud 23.6 → 23.8
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 +6 -10
- data/lib/aspose_cells_cloud/api/cells_api.rb +6 -82
- data/lib/aspose_cells_cloud/models/digital_signature.rb +294 -0
- data/lib/aspose_cells_cloud/models/html_save_options.rb +61 -1
- data/lib/aspose_cells_cloud/models/image_or_print_options.rb +498 -0
- data/lib/aspose_cells_cloud/models/ooxml_save_options.rb +49 -1
- data/lib/aspose_cells_cloud/models/pdf_save_options.rb +109 -1
- data/lib/aspose_cells_cloud/models/protect_workbook_requst.rb +270 -0
- data/lib/aspose_cells_cloud/models/protection.rb +402 -0
- data/lib/aspose_cells_cloud/models/rendering_font.rb +258 -0
- data/lib/aspose_cells_cloud/models/rendering_watermark.rb +330 -0
- data/lib/aspose_cells_cloud/requests/{get_extract_barcodes_request.rb → post_lock_request.rb} +30 -47
- data/lib/aspose_cells_cloud/requests/post_protect_request.rb +13 -8
- data/lib/aspose_cells_cloud/requests/post_repair_request.rb +116 -0
- data/lib/aspose_cells_cloud/version.rb +1 -1
- data/lib/aspose_cells_cloud.rb +8 -1
- data/spec/document/light_cells_spec.rb +58 -1
- data/spec/onecase_spec.rb +28 -0
- metadata +15 -8
- data/spec/api/cells_barcodes_controller_spec.rb +0 -31
@@ -31,6 +31,24 @@ require 'date'
|
|
31
31
|
module AsposeCellsCloud
|
32
32
|
|
33
33
|
class PdfSaveOptions
|
34
|
+
#
|
35
|
+
attr_accessor :display_doc_title
|
36
|
+
#
|
37
|
+
attr_accessor :export_document_structure
|
38
|
+
#
|
39
|
+
attr_accessor :emf_render_setting
|
40
|
+
#
|
41
|
+
attr_accessor :custom_properties_export
|
42
|
+
#
|
43
|
+
attr_accessor :optimization_type
|
44
|
+
#
|
45
|
+
attr_accessor :producer
|
46
|
+
#
|
47
|
+
attr_accessor :pdf_compression
|
48
|
+
#
|
49
|
+
attr_accessor :font_encoding
|
50
|
+
#
|
51
|
+
attr_accessor :watermark
|
34
52
|
#
|
35
53
|
attr_accessor :calculate_formula
|
36
54
|
#
|
@@ -71,6 +89,15 @@ module AsposeCellsCloud
|
|
71
89
|
# Attribute mapping from ruby-style variable name to JSON key.
|
72
90
|
def self.attribute_map
|
73
91
|
{
|
92
|
+
:'display_doc_title' => :'DisplayDocTitle',
|
93
|
+
:'export_document_structure' => :'ExportDocumentStructure',
|
94
|
+
:'emf_render_setting' => :'EmfRenderSetting',
|
95
|
+
:'custom_properties_export' => :'CustomPropertiesExport',
|
96
|
+
:'optimization_type' => :'OptimizationType',
|
97
|
+
:'producer' => :'Producer',
|
98
|
+
:'pdf_compression' => :'PdfCompression',
|
99
|
+
:'font_encoding' => :'FontEncoding',
|
100
|
+
:'watermark' => :'Watermark',
|
74
101
|
:'calculate_formula' => :'CalculateFormula',
|
75
102
|
:'check_font_compatibility' => :'CheckFontCompatibility',
|
76
103
|
:'compliance' => :'Compliance',
|
@@ -95,6 +122,15 @@ module AsposeCellsCloud
|
|
95
122
|
# Attribute type mapping.
|
96
123
|
def self.swagger_types
|
97
124
|
{
|
125
|
+
:'display_doc_title' => :'BOOLEAN',
|
126
|
+
:'export_document_structure' => :'BOOLEAN',
|
127
|
+
:'emf_render_setting' => :'String',
|
128
|
+
:'custom_properties_export' => :'String',
|
129
|
+
:'optimization_type' => :'String',
|
130
|
+
:'producer' => :'String',
|
131
|
+
:'pdf_compression' => :'String',
|
132
|
+
:'font_encoding' => :'String',
|
133
|
+
:'watermark' => :'RenderingWatermark',
|
98
134
|
:'calculate_formula' => :'BOOLEAN',
|
99
135
|
:'check_font_compatibility' => :'BOOLEAN',
|
100
136
|
:'compliance' => :'String',
|
@@ -124,6 +160,33 @@ module AsposeCellsCloud
|
|
124
160
|
# convert string to symbol for hash key
|
125
161
|
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
126
162
|
|
163
|
+
if attributes.has_key?(:'DisplayDocTitle')
|
164
|
+
self.display_doc_title = attributes[:'DisplayDocTitle']
|
165
|
+
end
|
166
|
+
if attributes.has_key?(:'ExportDocumentStructure')
|
167
|
+
self.export_document_structure = attributes[:'ExportDocumentStructure']
|
168
|
+
end
|
169
|
+
if attributes.has_key?(:'EmfRenderSetting')
|
170
|
+
self.emf_render_setting = attributes[:'EmfRenderSetting']
|
171
|
+
end
|
172
|
+
if attributes.has_key?(:'CustomPropertiesExport')
|
173
|
+
self.custom_properties_export = attributes[:'CustomPropertiesExport']
|
174
|
+
end
|
175
|
+
if attributes.has_key?(:'OptimizationType')
|
176
|
+
self.optimization_type = attributes[:'OptimizationType']
|
177
|
+
end
|
178
|
+
if attributes.has_key?(:'Producer')
|
179
|
+
self.producer = attributes[:'Producer']
|
180
|
+
end
|
181
|
+
if attributes.has_key?(:'PdfCompression')
|
182
|
+
self.pdf_compression = attributes[:'PdfCompression']
|
183
|
+
end
|
184
|
+
if attributes.has_key?(:'FontEncoding')
|
185
|
+
self.font_encoding = attributes[:'FontEncoding']
|
186
|
+
end
|
187
|
+
if attributes.has_key?(:'Watermark')
|
188
|
+
self.watermark = attributes[:'Watermark']
|
189
|
+
end
|
127
190
|
if attributes.has_key?(:'CalculateFormula')
|
128
191
|
self.calculate_formula = attributes[:'CalculateFormula']
|
129
192
|
end
|
@@ -185,6 +248,33 @@ module AsposeCellsCloud
|
|
185
248
|
# @return Array for valid properies with the reasons
|
186
249
|
def list_invalid_properties
|
187
250
|
invalid_properties = Array.new
|
251
|
+
if @display_doc_title.nil?
|
252
|
+
invalid_properties.push("invalid value for 'display_doc_title', display_doc_title cannot be nil.")
|
253
|
+
end
|
254
|
+
if @export_document_structure.nil?
|
255
|
+
invalid_properties.push("invalid value for 'export_document_structure', export_document_structure cannot be nil.")
|
256
|
+
end
|
257
|
+
if @emf_render_setting.nil?
|
258
|
+
invalid_properties.push("invalid value for 'emf_render_setting', emf_render_setting cannot be nil.")
|
259
|
+
end
|
260
|
+
if @custom_properties_export.nil?
|
261
|
+
invalid_properties.push("invalid value for 'custom_properties_export', custom_properties_export cannot be nil.")
|
262
|
+
end
|
263
|
+
if @optimization_type.nil?
|
264
|
+
invalid_properties.push("invalid value for 'optimization_type', optimization_type cannot be nil.")
|
265
|
+
end
|
266
|
+
if @producer.nil?
|
267
|
+
invalid_properties.push("invalid value for 'producer', producer cannot be nil.")
|
268
|
+
end
|
269
|
+
if @pdf_compression.nil?
|
270
|
+
invalid_properties.push("invalid value for 'pdf_compression', pdf_compression cannot be nil.")
|
271
|
+
end
|
272
|
+
if @font_encoding.nil?
|
273
|
+
invalid_properties.push("invalid value for 'font_encoding', font_encoding cannot be nil.")
|
274
|
+
end
|
275
|
+
if @watermark.nil?
|
276
|
+
invalid_properties.push("invalid value for 'watermark', watermark cannot be nil.")
|
277
|
+
end
|
188
278
|
if @calculate_formula.nil?
|
189
279
|
invalid_properties.push("invalid value for 'calculate_formula', calculate_formula cannot be nil.")
|
190
280
|
end
|
@@ -246,6 +336,15 @@ module AsposeCellsCloud
|
|
246
336
|
# Check to see if the all the properties in the model are valid
|
247
337
|
# @return true if the model is valid
|
248
338
|
def valid?
|
339
|
+
return false if @display_doc_title.nil?
|
340
|
+
return false if @export_document_structure.nil?
|
341
|
+
return false if @emf_render_setting.nil?
|
342
|
+
return false if @custom_properties_export.nil?
|
343
|
+
return false if @optimization_type.nil?
|
344
|
+
return false if @producer.nil?
|
345
|
+
return false if @pdf_compression.nil?
|
346
|
+
return false if @font_encoding.nil?
|
347
|
+
return false if @watermark.nil?
|
249
348
|
return false if @calculate_formula.nil?
|
250
349
|
return false if @check_font_compatibility.nil?
|
251
350
|
return false if @compliance.nil?
|
@@ -272,6 +371,15 @@ module AsposeCellsCloud
|
|
272
371
|
def ==(o)
|
273
372
|
return true if self.equal?(o)
|
274
373
|
self.class == o.class &&
|
374
|
+
display_doc_title == o.display_doc_title &&
|
375
|
+
export_document_structure == o.export_document_structure &&
|
376
|
+
emf_render_setting == o.emf_render_setting &&
|
377
|
+
custom_properties_export == o.custom_properties_export &&
|
378
|
+
optimization_type == o.optimization_type &&
|
379
|
+
producer == o.producer &&
|
380
|
+
pdf_compression == o.pdf_compression &&
|
381
|
+
font_encoding == o.font_encoding &&
|
382
|
+
watermark == o.watermark &&
|
275
383
|
calculate_formula == o.calculate_formula &&
|
276
384
|
check_font_compatibility == o.check_font_compatibility &&
|
277
385
|
compliance == o.compliance &&
|
@@ -302,7 +410,7 @@ module AsposeCellsCloud
|
|
302
410
|
# Calculates hash code according to all attributes.
|
303
411
|
# @return [Fixnum] Hash code
|
304
412
|
def hash
|
305
|
-
[ calculate_formula , check_font_compatibility , compliance , default_font , one_page_per_sheet , printing_page_type , security_options , desired_ppi , jpeg_quality , image_type , save_format , cached_file_folder , clear_data , create_directory , enable_http_compression , refresh_chart_cache , sort_names , validate_merged_areas ].hash
|
413
|
+
[ display_doc_title , export_document_structure , emf_render_setting , custom_properties_export , optimization_type , producer , pdf_compression , font_encoding , watermark , calculate_formula , check_font_compatibility , compliance , default_font , one_page_per_sheet , printing_page_type , security_options , desired_ppi , jpeg_quality , image_type , save_format , cached_file_folder , clear_data , create_directory , enable_http_compression , refresh_chart_cache , sort_names , validate_merged_areas ].hash
|
306
414
|
end
|
307
415
|
|
308
416
|
# Builds the object from hash
|
@@ -0,0 +1,270 @@
|
|
1
|
+
=begin
|
2
|
+
--------------------------------------------------------------------------------------------------------------------
|
3
|
+
<copyright company="Aspose" file="ProtectWorkbookRequstrb.cs">
|
4
|
+
Copyright (c) 2023 Aspose.Cells Cloud
|
5
|
+
</copyright>
|
6
|
+
<summary>
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
of this software and associated documentation files (the "Software"), to deal
|
9
|
+
in the Software without restriction, including without limitation the rights
|
10
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
copies of the Software, and to permit persons to whom the Software is
|
12
|
+
furnished to do so, subject to the following conditions:
|
13
|
+
|
14
|
+
The above copyright notice and this permission notice shall be included in all
|
15
|
+
copies or substantial portions of the Software.
|
16
|
+
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
23
|
+
SOFTWARE.
|
24
|
+
</summary>
|
25
|
+
--------------------------------------------------------------------------------------------------------------------
|
26
|
+
=end
|
27
|
+
|
28
|
+
|
29
|
+
require 'date'
|
30
|
+
|
31
|
+
module AsposeCellsCloud
|
32
|
+
|
33
|
+
class ProtectWorkbookRequst
|
34
|
+
#
|
35
|
+
attr_accessor :aways_open_only_ready
|
36
|
+
#
|
37
|
+
attr_accessor :encrypt_with_password
|
38
|
+
#
|
39
|
+
attr_accessor :protect_current_sheet
|
40
|
+
#
|
41
|
+
attr_accessor :protect_workbook_structure
|
42
|
+
#
|
43
|
+
attr_accessor :digital_signature
|
44
|
+
#
|
45
|
+
attr_accessor :mark_as_final
|
46
|
+
|
47
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
48
|
+
def self.attribute_map
|
49
|
+
{
|
50
|
+
:'aways_open_only_ready' => :'AwaysOpenOnlyReady',
|
51
|
+
:'encrypt_with_password' => :'EncryptWithPassword',
|
52
|
+
:'protect_current_sheet' => :'ProtectCurrentSheet',
|
53
|
+
:'protect_workbook_structure' => :'ProtectWorkbookStructure',
|
54
|
+
:'digital_signature' => :'DigitalSignature',
|
55
|
+
:'mark_as_final' => :'MarkAsFinal'
|
56
|
+
}
|
57
|
+
end
|
58
|
+
|
59
|
+
# Attribute type mapping.
|
60
|
+
def self.swagger_types
|
61
|
+
{
|
62
|
+
:'aways_open_only_ready' => :'BOOLEAN',
|
63
|
+
:'encrypt_with_password' => :'String',
|
64
|
+
:'protect_current_sheet' => :'Protection',
|
65
|
+
:'protect_workbook_structure' => :'String',
|
66
|
+
:'digital_signature' => :'DigitalSignature',
|
67
|
+
:'mark_as_final' => :'BOOLEAN'
|
68
|
+
}
|
69
|
+
end
|
70
|
+
|
71
|
+
# Initializes the object
|
72
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
73
|
+
def initialize(attributes = {})
|
74
|
+
return unless attributes.is_a?(Hash)
|
75
|
+
|
76
|
+
# convert string to symbol for hash key
|
77
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
78
|
+
|
79
|
+
if attributes.has_key?(:'AwaysOpenOnlyReady')
|
80
|
+
self.aways_open_only_ready = attributes[:'AwaysOpenOnlyReady']
|
81
|
+
end
|
82
|
+
if attributes.has_key?(:'EncryptWithPassword')
|
83
|
+
self.encrypt_with_password = attributes[:'EncryptWithPassword']
|
84
|
+
end
|
85
|
+
if attributes.has_key?(:'ProtectCurrentSheet')
|
86
|
+
self.protect_current_sheet = attributes[:'ProtectCurrentSheet']
|
87
|
+
end
|
88
|
+
if attributes.has_key?(:'ProtectWorkbookStructure')
|
89
|
+
self.protect_workbook_structure = attributes[:'ProtectWorkbookStructure']
|
90
|
+
end
|
91
|
+
if attributes.has_key?(:'DigitalSignature')
|
92
|
+
self.digital_signature = attributes[:'DigitalSignature']
|
93
|
+
end
|
94
|
+
if attributes.has_key?(:'MarkAsFinal')
|
95
|
+
self.mark_as_final = attributes[:'MarkAsFinal']
|
96
|
+
end
|
97
|
+
|
98
|
+
end
|
99
|
+
|
100
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
101
|
+
# @return Array for valid properies with the reasons
|
102
|
+
def list_invalid_properties
|
103
|
+
invalid_properties = Array.new
|
104
|
+
if @aways_open_only_ready.nil?
|
105
|
+
invalid_properties.push("invalid value for 'aways_open_only_ready', aways_open_only_ready cannot be nil.")
|
106
|
+
end
|
107
|
+
if @encrypt_with_password.nil?
|
108
|
+
invalid_properties.push("invalid value for 'encrypt_with_password', encrypt_with_password cannot be nil.")
|
109
|
+
end
|
110
|
+
if @protect_current_sheet.nil?
|
111
|
+
invalid_properties.push("invalid value for 'protect_current_sheet', protect_current_sheet cannot be nil.")
|
112
|
+
end
|
113
|
+
if @protect_workbook_structure.nil?
|
114
|
+
invalid_properties.push("invalid value for 'protect_workbook_structure', protect_workbook_structure cannot be nil.")
|
115
|
+
end
|
116
|
+
if @digital_signature.nil?
|
117
|
+
invalid_properties.push("invalid value for 'digital_signature', digital_signature cannot be nil.")
|
118
|
+
end
|
119
|
+
if @mark_as_final.nil?
|
120
|
+
invalid_properties.push("invalid value for 'mark_as_final', mark_as_final cannot be nil.")
|
121
|
+
end
|
122
|
+
|
123
|
+
return invalid_properties
|
124
|
+
end
|
125
|
+
|
126
|
+
# Check to see if the all the properties in the model are valid
|
127
|
+
# @return true if the model is valid
|
128
|
+
def valid?
|
129
|
+
return false if @aways_open_only_ready.nil?
|
130
|
+
return false if @encrypt_with_password.nil?
|
131
|
+
return false if @protect_current_sheet.nil?
|
132
|
+
return false if @protect_workbook_structure.nil?
|
133
|
+
return false if @digital_signature.nil?
|
134
|
+
return false if @mark_as_final.nil?
|
135
|
+
return true
|
136
|
+
end
|
137
|
+
|
138
|
+
# Checks equality by comparing each attribute.
|
139
|
+
# @param [Object] Object to be compared
|
140
|
+
def ==(o)
|
141
|
+
return true if self.equal?(o)
|
142
|
+
self.class == o.class &&
|
143
|
+
aways_open_only_ready == o.aways_open_only_ready &&
|
144
|
+
encrypt_with_password == o.encrypt_with_password &&
|
145
|
+
protect_current_sheet == o.protect_current_sheet &&
|
146
|
+
protect_workbook_structure == o.protect_workbook_structure &&
|
147
|
+
digital_signature == o.digital_signature &&
|
148
|
+
mark_as_final == o.mark_as_final
|
149
|
+
std_dev == o.std_dev
|
150
|
+
end
|
151
|
+
|
152
|
+
# @see the `==` method
|
153
|
+
# @param [Object] Object to be compared
|
154
|
+
def eql?(o)
|
155
|
+
self == o
|
156
|
+
end
|
157
|
+
|
158
|
+
# Calculates hash code according to all attributes.
|
159
|
+
# @return [Fixnum] Hash code
|
160
|
+
def hash
|
161
|
+
[ aways_open_only_ready , encrypt_with_password , protect_current_sheet , protect_workbook_structure , digital_signature , mark_as_final ].hash
|
162
|
+
end
|
163
|
+
|
164
|
+
# Builds the object from hash
|
165
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
166
|
+
# @return [Object] Returns the model itself
|
167
|
+
def build_from_hash(attributes)
|
168
|
+
return nil unless attributes.is_a?(Hash)
|
169
|
+
self.class.swagger_types.each_pair do |key, type|
|
170
|
+
if type =~ /\AArray<(.*)>/i
|
171
|
+
# check to ensure the input is an array given that the the attribute
|
172
|
+
# is documented as an array but the input is not
|
173
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
174
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
175
|
+
end
|
176
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
177
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
178
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
179
|
+
end
|
180
|
+
|
181
|
+
self
|
182
|
+
end
|
183
|
+
|
184
|
+
# Deserializes the data based on type
|
185
|
+
# @param string type Data type
|
186
|
+
# @param string value Value to be deserialized
|
187
|
+
# @return [Object] Deserialized data
|
188
|
+
def _deserialize(type, value)
|
189
|
+
case type.to_sym
|
190
|
+
when :DateTime
|
191
|
+
DateTime.parse(value)
|
192
|
+
when :Date
|
193
|
+
Date.parse(value)
|
194
|
+
when :String
|
195
|
+
value.to_s
|
196
|
+
when :Integer
|
197
|
+
value.to_i
|
198
|
+
when :Float
|
199
|
+
value.to_f
|
200
|
+
when :BOOLEAN
|
201
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
202
|
+
true
|
203
|
+
else
|
204
|
+
false
|
205
|
+
end
|
206
|
+
when :Object
|
207
|
+
# generic object (usually a Hash), return directly
|
208
|
+
value
|
209
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
210
|
+
inner_type = Regexp.last_match[:inner_type]
|
211
|
+
value.map { |v| _deserialize(inner_type, v) }
|
212
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
213
|
+
k_type = Regexp.last_match[:k_type]
|
214
|
+
v_type = Regexp.last_match[:v_type]
|
215
|
+
{}.tap do |hash|
|
216
|
+
value.each do |k, v|
|
217
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
218
|
+
end
|
219
|
+
end
|
220
|
+
else # model
|
221
|
+
temp_model = AsposeCellsCloud.const_get(type).new
|
222
|
+
temp_model.build_from_hash(value)
|
223
|
+
end
|
224
|
+
end
|
225
|
+
|
226
|
+
# Returns the string representation of the object
|
227
|
+
# @return [String] String presentation of the object
|
228
|
+
def to_s
|
229
|
+
to_hash.to_s
|
230
|
+
end
|
231
|
+
|
232
|
+
# to_body is an alias to to_hash (backward compatibility)
|
233
|
+
# @return [Hash] Returns the object in the form of hash
|
234
|
+
def to_body
|
235
|
+
to_hash
|
236
|
+
end
|
237
|
+
|
238
|
+
# Returns the object in the form of hash
|
239
|
+
# @return [Hash] Returns the object in the form of hash
|
240
|
+
def to_hash
|
241
|
+
hash = {}
|
242
|
+
self.class.attribute_map.each_pair do |attr, param|
|
243
|
+
value = self.send(attr)
|
244
|
+
next if value.nil?
|
245
|
+
hash[param] = _to_hash(value)
|
246
|
+
end
|
247
|
+
hash
|
248
|
+
end
|
249
|
+
|
250
|
+
# Outputs non-array value in the form of hash
|
251
|
+
# For object, use to_hash. Otherwise, just return the value
|
252
|
+
# @param [Object] value Any valid value
|
253
|
+
# @return [Hash] Returns the value in the form of hash
|
254
|
+
def _to_hash(value)
|
255
|
+
if value.is_a?(Array)
|
256
|
+
value.compact.map{ |v| _to_hash(v) }
|
257
|
+
elsif value.is_a?(Hash)
|
258
|
+
{}.tap do |hash|
|
259
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
260
|
+
end
|
261
|
+
elsif value.respond_to? :to_hash
|
262
|
+
value.to_hash
|
263
|
+
else
|
264
|
+
value
|
265
|
+
end
|
266
|
+
end
|
267
|
+
|
268
|
+
end
|
269
|
+
|
270
|
+
end
|