neewom 0.1.1 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d163bc5e17faec7b60144b8c445d2f21139eee4dfc12748363a2c45ee561c685
4
- data.tar.gz: 0e2a0312d4e137a2da16e8f57c6b2a2ffe4cc1774eff5b08f7fc26b574e60ed0
3
+ metadata.gz: ff4eda13e729d7f2410e026e11db2027c4aeb9dc9c117f7d21999b51a6a425bf
4
+ data.tar.gz: a1956f0867d8eac9a195ffda89d9ed886e9b2749316137020a7654239a7b0ab7
5
5
  SHA512:
6
- metadata.gz: 4c3e74e0a21f4f542bdefece564ad601d0765bcbb1c1100ac47f16617438db68b8832acbab921e60dfda7e3db23938e64b478cb96852d928181d7882e4068a41
7
- data.tar.gz: 8d64de3fe84c30642e6d7ed5eb6b5126926ea9f463ca4cf01f538204ba854176c36554cbc913ca7bfd3410e2c04c8ffbce32e1da28b3893ee00a8a7ecae63f95
6
+ metadata.gz: 211ecf2936c34531a59be8f754ca0086ebfd949addd462d029a1db6142a05cb20097469ce494ab0e71d1791642dbbf90ba622b6a45b4b7397cf3e624badedb03
7
+ data.tar.gz: fc16aafa6864350002129ecdc4ad30a69f73e7c6302728f7b0b84b94bebf28eb511acbc4626af2c51f280b20c5b479da08a630a419f57ed61b38ab01f059cae1
@@ -12,18 +12,18 @@ module Neewom
12
12
 
13
13
  form_record.transaction do
14
14
  form_record.assign_attributes(
15
- repository_klass: abstract_form.repository_klass,
16
- template: abstract_form.template,
17
- crc32: current_crc,
15
+ repository_klass: abstract_form.repository_klass,
16
+ template: abstract_form.template,
17
+ crc32: current_crc,
18
18
  persist_submit_controls: (abstract_form.persist_submit_controls || false)
19
19
  )
20
20
  existing_fields = form_record.custom_fields.to_a
21
21
 
22
22
  abstract_form.fields.each_with_index do |field, index|
23
23
  if field.collection.present?
24
- raise "Form with specified collection could not be stored."
24
+ raise "Form with specified collection could not be stored."
25
25
  end
26
-
26
+
27
27
  field_record = existing_fields.find { |item| item.name.to_s == field.name.to_s }
28
28
  field_record ||= Neewom::CustomField.new(custom_form: form_record, name: field.name)
29
29
 
@@ -47,7 +47,7 @@ module Neewom
47
47
 
48
48
  removable_fields = existing_fields.select { |item| abstract_form.fields.none? { |f| f.name.to_s == item.name.to_s } }
49
49
  removable_fields.each(&:destroy)
50
-
50
+
51
51
  form_record.save!
52
52
  end
53
53
 
@@ -70,7 +70,7 @@ module Neewom
70
70
  field.validations = JSON.parse(field_record.validations, symbolize_names: true)
71
71
  field.collection_klass = field_record.collection_klass
72
72
  field.collection_method = field_record.collection_method
73
- field.collection_params = JSON.parse(field_record.collection_params)&.map(&:to_sym)
73
+ field.collection_params = JSON.parse(field_record.collection_params)
74
74
  field.label_method = field_record.label_method
75
75
  field.value_method = field_record.value_method
76
76
  field.input_html = JSON.parse(field_record.input_html, symbolize_names: true)
@@ -82,7 +82,7 @@ module Neewom
82
82
  form
83
83
  end
84
84
 
85
- private
85
+ private
86
86
 
87
87
  def calculate_crc32(abstract_form)
88
88
  buff = [abstract_form.id, abstract_form.repository_klass, abstract_form.template, abstract_form.persist_submit_controls].join(':')
@@ -103,8 +103,8 @@ module Neewom
103
103
  field.custom_options.to_json
104
104
  ].map(&:to_s)
105
105
  end.flatten.join(':')
106
-
106
+
107
107
  Zlib::crc32(buff).to_s
108
- end
109
- end
110
- end
108
+ end
109
+ end
110
+ end
@@ -1,3 +1,3 @@
1
1
  module Neewom
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neewom
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Deadman
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-06-25 00:00:00.000000000 Z
11
+ date: 2021-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler