ar_doc_store 0.0.3 → 0.0.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
  SHA1:
3
- metadata.gz: 9bc6988ec4fcb270a64c6e8ab1bca2ba8fd6590a
4
- data.tar.gz: 7d11854e6bca4785b91a87e5f3bec76847e621c5
3
+ metadata.gz: f53b88c6de1ed3b89140686a6322e0e657019fb4
4
+ data.tar.gz: 27633939568dfd0e2534e7c7fbd588fd8fec4521
5
5
  SHA512:
6
- metadata.gz: b219537a7081e7325f968e674efe0e31c16d48c5f145e1d470dc95316628f75196232ec7aaa44197dd27152b5eba6ead6579ca6d2ca6f2d0178ee1ef95c27742
7
- data.tar.gz: 22efd90e20b683daef4bb7b2497f0353de52da1b09a28ab2e76279c312d05b3bb9b67073fd8ca6dbaf3852679859af7a37efa7a2619a7b045b81539b5981b8e6
6
+ metadata.gz: 9c7f66c471005f5ad2777203e864019452c855018010becb66300aa2c0c6f6ed065785362fae8da98f96fe4a7e9c829e74a93d0732cd23d608d5d1b97a4426b7
7
+ data.tar.gz: 1c7540f9d60c030368a27d253cacca11ee8ac2187acefa43404de7f4a0bb3ef8c12952fcb2e73dae9f71075bb6ab876e5452aa4db5f1692eb2edbbb7daab7c02
@@ -15,6 +15,10 @@ module ArDocStore
15
15
  end
16
16
  end
17
17
 
18
+ def type
19
+ :array
20
+ end
21
+
18
22
  end
19
23
 
20
24
  end
@@ -1,7 +1,7 @@
1
1
  module ArDocStore
2
2
  module AttributeTypes
3
3
  class Base
4
- attr_accessor :conversion, :predicate, :options, :model, :attribute
4
+ attr_accessor :conversion, :predicate, :options, :model, :attribute, :default
5
5
 
6
6
  def self.build(model, attribute, options={})
7
7
  new(model, attribute, options).build
@@ -9,20 +9,12 @@ module ArDocStore
9
9
 
10
10
  def initialize(model, attribute, options)
11
11
  @model, @attribute, @options = model, attribute, options
12
- add_to_columns_hash
13
12
  end
14
13
 
15
14
  def build
16
15
  model.store_attributes conversion, predicate, attribute
17
16
  end
18
17
 
19
- def add_to_columns_hash
20
- model.columns_hash[attribute.to_s] = ActiveRecord::ConnectionAdapters::PostgreSQLColumn.new(attribute, nil, column_type)
21
- end
22
-
23
- def column_type
24
- ActiveRecord::Type::String.new
25
- end
26
18
  end
27
19
 
28
20
  end
@@ -17,8 +17,8 @@ module ArDocStore
17
17
  end
18
18
  end
19
19
 
20
- def column_type
21
- ActiveRecord::Type::Boolean.new
20
+ def type
21
+ :boolean
22
22
  end
23
23
 
24
24
  end
@@ -32,6 +32,10 @@ module ArDocStore
32
32
  end
33
33
  end
34
34
 
35
+ def type
36
+ :string
37
+ end
38
+
35
39
  end
36
40
  end
37
41
  end
@@ -10,8 +10,8 @@ module ArDocStore
10
10
  'float'
11
11
  end
12
12
 
13
- def column_type
14
- ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Decimal.new
13
+ def type
14
+ :number
15
15
  end
16
16
 
17
17
  end
@@ -10,8 +10,8 @@ module ArDocStore
10
10
  'int'
11
11
  end
12
12
 
13
- def column_type
14
- ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer.new
13
+ def type
14
+ :number
15
15
  end
16
16
 
17
17
  end
@@ -45,7 +45,7 @@ module ArDocStore
45
45
  items
46
46
  }
47
47
  define_method "#{assn_name}=".to_sym, -> (values) {
48
- if values
48
+ if values && values.respond_to?(:map)
49
49
  items = values.map { |item|
50
50
  my_class_name = class_name.constantize
51
51
  item.is_a?(my_class_name) ? item : my_class_name.new(item)
@@ -1,3 +1,3 @@
1
1
  module ArDocStore
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ar_doc_store
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Furber
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-13 00:00:00.000000000 Z
11
+ date: 2015-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord