sequel-through 0.3.1 → 0.4.0

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: 052c754323070df67e30e29c408efacdd3fc04da4a973e84551fe0d3ee6ed730
4
- data.tar.gz: 1f8ab70b4bb87ed7889e2fd9339c56328e09fbe1f4e7c493cc5fb799955db37e
3
+ metadata.gz: b36de973b7d7a5a8c056388a0f3c2d5227d5c34a562953baeb5594f92d7a4c32
4
+ data.tar.gz: 633332a805b889735b7ea1e4bb912f2ea6d70b905c030cb3e9b6f1ff161d4530
5
5
  SHA512:
6
- metadata.gz: c6264ff5cb4701d009e11e5cfaec4bc8e5d02696f5bd634605b2e3f3eff5aeaae505be0495c806ccd4daf6e489a205dadeca19341fe4bec985d1fbb28e167c09
7
- data.tar.gz: 5f749f13768fb60fa0c1dabbc56de70f6adaab0db284cbc3a0ac2988a3b6fb887fa809ae205cbf2dce06d1d7b81267ce14772d7e71c951f747ff8651a4e8a7a3
6
+ metadata.gz: 330ce985ceeeab5b9d1ec998fcca52689718cd083a55bc23dc1351c1d7115464b0504348bbd2dbb27b4c12a0c14f6a798c1fbdc6874f78f74d60f1bc70bdce0c
7
+ data.tar.gz: 189d343a39b3aa6d94e9f46e970000e2debe74edae7ab1c84647f06697b4d36250446a43d8c0424662fba852b15e045539a93538a6481bc13761f29a9c54dc44
@@ -0,0 +1,4 @@
1
+ ## v0.4.0
2
+
3
+ - [x] Scopes plugin data to the class it is included on
4
+ - [x] Plays nicely with `:dataset_associations`
@@ -9,8 +9,10 @@ module Sequel
9
9
 
10
10
  module ClassMethods
11
11
 
12
- @@_resolving = false
13
- @@_resolver_stack = []
12
+ def self.extended mod
13
+ @@_resolving = false
14
+ @@_resolver_stack = []
15
+ end
14
16
 
15
17
  # Solves any remaining cyclical associations
16
18
  def solve_cyclical_associations!
@@ -18,9 +18,11 @@ module Sequel
18
18
  def self.apply mod
19
19
  Sequel.extension :inflector unless "".respond_to?(:pluralize)
20
20
  mod.plugin :many_through_many
21
+ mod.singleton_class.prepend PrependClassMethods
21
22
  end
22
23
 
23
- module ClassMethods
24
+ # This ensures that our definition of associate jumps the stack
25
+ module PrependClassMethods
24
26
 
25
27
  def associate type, name, opts = OPTS, &block
26
28
 
@@ -33,10 +35,17 @@ module Sequel
33
35
 
34
36
  end
35
37
 
38
+ end
39
+
40
+ module ClassMethods
41
+
36
42
  # Associates a related model with the current model using another association
37
43
  # as the intermediary.
38
44
  def associate_through type, name, opts, &block
39
- raise Error, "#{type} does not support through associations" unless assoc_type = Sequel.synchronize{ASSOCIATION_THROUGH_TYPES[type]}
45
+
46
+ unless assoc_type = Sequel.synchronize{ASSOCIATION_THROUGH_TYPES[type]}
47
+ raise Error, "#{type} does not support through associations"
48
+ end
40
49
 
41
50
  result = find_association_path(**opts, name: name, models: self, from_through: true)
42
51
 
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
 
4
4
  Gem::Specification.new do |spec|
5
5
  spec.name = "sequel-through"
6
- spec.version = "0.3.1"
6
+ spec.version = "0.4.0"
7
7
  spec.authors = ["Kenaniah Cerny"]
8
8
  spec.email = ["kenaniah@gmail.com"]
9
9
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequel-through
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kenaniah Cerny
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-03-05 00:00:00.000000000 Z
11
+ date: 2019-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sequel
@@ -75,6 +75,7 @@ extra_rdoc_files: []
75
75
  files:
76
76
  - ".gitignore"
77
77
  - ".travis.yml"
78
+ - CHANGELOG.md
78
79
  - Gemfile
79
80
  - LICENSE.txt
80
81
  - README.md
@@ -107,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
108
  - !ruby/object:Gem::Version
108
109
  version: '0'
109
110
  requirements: []
110
- rubygems_version: 3.0.1
111
+ rubygems_version: 3.0.3
111
112
  signing_key:
112
113
  specification_version: 4
113
114
  summary: Adds support for :through associations to sequel