umbrellio-sequel-plugins 0.10.0.100 → 0.10.0.101

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 461c2e1edac7a90a93262bab9b44b28455d14db79872bd6b18a488da9d5f9afc
4
- data.tar.gz: 2ea67f3af3a257f59018861b698b3c0dc7e950f7421f0db0b75c5d08081be0c2
3
+ metadata.gz: 7fa321f3720c745f853bf852f1fbfcb430b35391ff67d48284f051ff804c3e20
4
+ data.tar.gz: 0d1d70e9f8f05173b63b62db97dfa5f4e562527d7b9e87affdbd8f2151987757
5
5
  SHA512:
6
- metadata.gz: d0f60ef1050a1c2fd371b0525c9375ca275dd9cd2d1edff184c5df229063f24cd0dba7214cb65fe1a9380040b3ad6c226e29face260c303604087fcd9ab0dd7a
7
- data.tar.gz: e5c02e8cd6d4c4afeb48ec2b4624fcb21d906cf40481f88a8cef556decca0e7adf3ec228b36edef23f972d50af5c5817678effb6df5dd27127f8c8ac4f3579c4
6
+ metadata.gz: b40811232e8e9b6a711b134ae831cb05c04bc85553587bffa7bd65f0d77105ff12d0e739fa84e6048a02ca254e0782dd8bf200e488b7c9437d89c170f199862e
7
+ data.tar.gz: b8060ae4b412df5d1a459c19f5187aa27acddf8cc753465f1dd38844d8301e68e5a703a00de9530818f7d529757f4dc89aa592165542f542b3495676283c45ed
@@ -16,7 +16,7 @@ module Sequel::Plugins::StoreAccessors
16
16
  # user.first_name # => "John"
17
17
  # user.data # => {"first_name": "John"}
18
18
  def store(column, *fields)
19
- include_accessors_module(column)
19
+ include_accessors_module
20
20
 
21
21
  fields.each do |field|
22
22
  define_store_getter(column, field)
@@ -26,16 +26,10 @@ module Sequel::Plugins::StoreAccessors
26
26
 
27
27
  private
28
28
 
29
- def include_accessors_module(column)
30
- unless defined?(@_store_accessors_module)
31
- @_store_accessors_module = Module.new
32
- include @_store_accessors_module
33
- end
34
-
35
- prev_columns = @_store_accessors_module.instance_variable_get(:@_store_columns) || []
36
- new_columns = [*prev_columns, column]
37
- @_store_accessors_module.instance_variable_set(:@_store_columns, new_columns)
38
- @_store_accessors_module.define_method(:store_columns) { new_columns }
29
+ def include_accessors_module
30
+ return if defined?(@_store_accessors_module)
31
+ @_store_accessors_module = Module.new
32
+ include @_store_accessors_module
39
33
  end
40
34
 
41
35
  def define_store_getter(column, field)
@@ -54,21 +48,4 @@ module Sequel::Plugins::StoreAccessors
54
48
  end
55
49
  end
56
50
  end
57
-
58
- module InstanceMethods
59
- def before_update
60
- super
61
- return unless respond_to?(:store_columns)
62
- send(:store_columns).each do |store_column|
63
- json = Sequel[store_column].pg_jsonb.concat(send(store_column))
64
- send("#{store_column}=", json) if changed_columns.include?(store_column)
65
- end
66
- end
67
-
68
- def after_update
69
- super
70
- return unless respond_to?(:store_columns)
71
- reload unless send(:store_columns).all?(Hash)
72
- end
73
- end
74
51
  end
data/utils/database.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  require "logger"
4
4
 
5
- DB = Sequel.connect(ENV.fetch("DB_URL", "postgres:///sequel_plugins"))
5
+ DB = Sequel.connect(ENV.fetch("DB_URL", "postgres://localhost/sequel_plugins"))
6
6
  DB.logger = Logger.new("log/db.log")
7
7
 
8
8
  Sequel::Model.db = DB
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: umbrellio-sequel-plugins
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0.100
4
+ version: 0.10.0.101
5
5
  platform: ruby
6
6
  authors:
7
7
  - Team Umbrellio