snaptable 2.2.3 → 2.2.4

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: b0203c800bc07e68796bd21371315d3ad87d083f0431d2c9aa42b7b856dde471
4
- data.tar.gz: 5c33e463f36a732c9091f379ced36caf3d2e105cb5c080cdff1879cd022c6506
3
+ metadata.gz: 116494e78d771e3bfc4e6e354a11dc0b96cd4da7b265135f4382c00a204c4cc1
4
+ data.tar.gz: 1978b61ee80c3405e2075b2f4f69a533218b2112e44e74bed0343c4f7a2c2907
5
5
  SHA512:
6
- metadata.gz: c76e95b4382399619cbe008fe107ee9f2c3ecb1c0e519d5afce71993e932c0f9c717afaf405d1b897ba1a633ee9dae8da53a371ac60d40417037486b20c8466b
7
- data.tar.gz: 28736105c9c34676597409ab2e32b1c042d77be09cdbab4c354dd062085dfca9acd97482ab177887ac920b9caccbe370a551ff10094cc9bcfcccbbf96eb3b540
6
+ metadata.gz: 56b0ef96cae11ce4f2c485fef01185a962881f33054d783d273b4f8c953738a41c69bd29a33c24e9bcb90dc0a01c6d247e4063a8bc9dba29137dd5d731e1807e
7
+ data.tar.gz: 248667837e08cea9bb4748c8fc633c8cb798bce2f6efcb9d45ba8a1ac6313fb5dfbd4e33074b8bce2518e387fba48419c38e31c95a57fa2bd96c4d210f46145b
@@ -32,7 +32,7 @@ module Snaptable
32
32
  attr_value = element.send(attribute)
33
33
  else # a hash { model: :attribute }
34
34
  attr_value = element.send(attribute.keys[0]).send(attribute.values[0])
35
- attr_model = attribute.keys[0].to_s.capitalize.constantize
35
+ attr_model = string_to_class(attribute.keys[0].to_s)
36
36
  attribute = attribute.values[0]
37
37
  end
38
38
  format(attribute, attr_value, attr_model)
@@ -55,6 +55,14 @@ module Snaptable
55
55
  model.defined_enums.keys
56
56
  end
57
57
 
58
+ def string_to_class(string)
59
+ begin
60
+ return string.classify.constantize
61
+ rescue NameError
62
+ return nil
63
+ end
64
+ end
65
+
58
66
  end
59
67
  end
60
68
  end
@@ -1,3 +1,3 @@
1
1
  module Snaptable
2
- VERSION = "2.2.3"
2
+ VERSION = "2.2.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snaptable
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.3
4
+ version: 2.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - khcr
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-06 00:00:00.000000000 Z
11
+ date: 2019-02-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails