glue_gun_dsl 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/glue_gun/types/array_type.rb +28 -0
- data/lib/glue_gun/types.rb +9 -0
- data/lib/glue_gun/version.rb +1 -1
- data/lib/glue_gun.rb +1 -3
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e97baa6c4e171ff7016d72e17e6aa8bbaac29f1787334e2adf179286e6e3acab
|
4
|
+
data.tar.gz: bf07da1a28c264674715852b26548c82b91c8a752079ce81ab463dddf33dd54c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 773d89754959c7bcdc8aa211e52ba5f62d51803388bbf0938081efea5acbb0eba69fae543a5ef9b41315018fcaa530a2f709e78afe89615f57c85912848fc2e3
|
7
|
+
data.tar.gz: c85ffa384466da228d4442b303db20bd07ae83262981b24b10675d67eaca168f7bdf6a14f88ee617c780402086b10677fc0302b8d08096851bfbcebb5294a2bf
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module GlueGun
|
2
|
+
module Types
|
3
|
+
class ArrayType < ActiveModel::Type::Value
|
4
|
+
def cast(value)
|
5
|
+
case value
|
6
|
+
when String
|
7
|
+
parse_string(value)
|
8
|
+
when Array
|
9
|
+
value
|
10
|
+
else
|
11
|
+
[]
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def serialize(value)
|
16
|
+
value.to_json
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def parse_string(value)
|
22
|
+
JSON.parse(value)
|
23
|
+
rescue JSON::ParserError
|
24
|
+
[]
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/glue_gun/version.rb
CHANGED
data/lib/glue_gun.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glue_gun_dsl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brett Shollenberger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-10-
|
11
|
+
date: 2024-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -129,6 +129,8 @@ extra_rdoc_files: []
|
|
129
129
|
files:
|
130
130
|
- lib/glue_gun.rb
|
131
131
|
- lib/glue_gun/dsl.rb
|
132
|
+
- lib/glue_gun/types.rb
|
133
|
+
- lib/glue_gun/types/array_type.rb
|
132
134
|
- lib/glue_gun/types/hash_type.rb
|
133
135
|
- lib/glue_gun/version.rb
|
134
136
|
homepage: https://github.com/brettshollenberger/glue_gun
|