sunstone 1.7.14 → 1.7.15
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e1a040da7c5582af4d08e24026a9e465f6d0d77a
|
4
|
+
data.tar.gz: b5f6a84d66856b58a882d6852d248ff472560ae0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8fbac180e9d41be25ca93e247b3d04fe517f256176830637f1e47b1865a36e9a4f1500de153ca2bb8b47027126566945a0d7bce828cdcc2868926b92db11316e
|
7
|
+
data.tar.gz: 1a0a220d9340b22c4974ded165009d6d44dee58b459dcc31979e23c98a5b4f84a6263695efacbd22c8d55ac09574b6846ee5825ab5bd1bdad02ff6f2d1cf6f1f
|
@@ -7,7 +7,11 @@ module ActiveRecord
|
|
7
7
|
def initialize(name, cast_type, options={})
|
8
8
|
@primary_key = (options['primary_key'] == true)
|
9
9
|
@array = !!options['array']
|
10
|
-
|
10
|
+
if @array
|
11
|
+
super(name, options['default'], Sunstone::Type::Array.new(cast_type), nil, options['null'])
|
12
|
+
else
|
13
|
+
super(name, options['default'], cast_type, nil, options['null'])
|
14
|
+
end
|
11
15
|
end
|
12
16
|
|
13
17
|
def primary_key?
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module ActiveRecord
|
2
|
+
module ConnectionAdapters
|
3
|
+
module Sunstone
|
4
|
+
module Type
|
5
|
+
class Array < ActiveRecord::Type::Value
|
6
|
+
include ActiveRecord::Type::Mutable
|
7
|
+
|
8
|
+
attr_reader :subtype
|
9
|
+
delegate :type, to: :subtype
|
10
|
+
|
11
|
+
def initialize(subtype)
|
12
|
+
@subtype = subtype
|
13
|
+
end
|
14
|
+
|
15
|
+
def type_cast_for_database(value)
|
16
|
+
super(value).to_json if value
|
17
|
+
end
|
18
|
+
|
19
|
+
def cast_value(string)
|
20
|
+
return string unless string.is_a?(::String)
|
21
|
+
return if string.empty?
|
22
|
+
|
23
|
+
JSON.parse(string)
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -9,6 +9,7 @@ require 'active_record/connection_adapters/sunstone/schema_statements'
|
|
9
9
|
require 'active_record/connection_adapters/sunstone/column'
|
10
10
|
|
11
11
|
require 'active_record/connection_adapters/sunstone/type/date_time'
|
12
|
+
require 'active_record/connection_adapters/sunstone/type/array'
|
12
13
|
|
13
14
|
module ActiveRecord
|
14
15
|
module ConnectionHandling # :nodoc:
|
data/sunstone.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sunstone
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.7.
|
4
|
+
version: 1.7.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jon Bracy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -264,6 +264,7 @@ files:
|
|
264
264
|
- lib/active_record/connection_adapters/sunstone/column.rb
|
265
265
|
- lib/active_record/connection_adapters/sunstone/database_statements.rb
|
266
266
|
- lib/active_record/connection_adapters/sunstone/schema_statements.rb
|
267
|
+
- lib/active_record/connection_adapters/sunstone/type/array.rb
|
267
268
|
- lib/active_record/connection_adapters/sunstone/type/date_time.rb
|
268
269
|
- lib/active_record/connection_adapters/sunstone_adapter.rb
|
269
270
|
- lib/arel/collectors/sunstone.rb
|