joiner 0.4.2 → 0.5.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: 543a8c9e2753e70cbf20bfa1339d9fb694dbddbe7acdaa221dcd61eed414eba3
4
- data.tar.gz: 4e6c0ee07f07efe8fd4c7c0d690240e1204975b5c17d66e468c7cf46b6b6d4a1
3
+ metadata.gz: 76a7e71eaef54a09627a9d72231ab9fe99c966736a7c7bffbedcd110bcbcef4a
4
+ data.tar.gz: 8aed7b7b5081bf0c564ea7e81f6a2d229f4e5e0b45b4ce3aae89d15e19879d39
5
5
  SHA512:
6
- metadata.gz: e65737d1f81fb60fca11d8c5360f25a03f652c516e42481ca9ebbf88df1006408b06d527f43511f16d1f71e1f4ce62332fe8ef6aa47bc6d8946dd1a74320a55a
7
- data.tar.gz: 468e756f7560b6dce83e95b59d8dc852e2c87f96436512755101cb63e1bb597061a62f41a56c553cedd698bb33065624a04f729cef02ae3b9c68f7aed056308a
6
+ metadata.gz: 00b8286b10577f26e2999601cfb4cf5c73b213ef452fa8608ccbbb1b5d33cb27b0505b08fac73a90d951dc18f7f9636be1c2fb58e39ac073aa0fbed73298e516
7
+ data.tar.gz: 944cf099ea7df456ecfe2f52a21a624bef9e74154d524425e845312a626b4be5d72b264467a2fd38be4fdefd14097a88a1ee0fd40d1ba0009506664892c63b3b
@@ -0,0 +1,9 @@
1
+ language: ruby
2
+ dist: xenial
3
+ sudo: false
4
+ rvm:
5
+ - 2.5.5
6
+ - 2.6.3
7
+ before_install:
8
+ - gem update --system
9
+ script: bundle exec rspec
data/README.md CHANGED
@@ -9,7 +9,7 @@ If this gem is used by anyone other than myself/Thinking Sphinx, I'll be surpris
9
9
  It's a gem - so you can either install it yourself, or add it to the appropriate Gemfile or gemspec.
10
10
 
11
11
  ```term
12
- gem install joiner --version 0.4.2
12
+ gem install joiner --version 0.5.0
13
13
  ```
14
14
 
15
15
  ## Usage
@@ -59,4 +59,4 @@ Please note that this project now has a [Contributor Code of Conduct](http://con
59
59
 
60
60
  ## Licence
61
61
 
62
- Copyright (c) 2013-2018, Joiner is developed and maintained by [Pat Allan](http://freelancing-gods.com), and is released under the open MIT Licence.
62
+ Copyright (c) 2013-2019, Joiner is developed and maintained by [Pat Allan](http://freelancing-gods.com), and is released under the open MIT Licence.
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
  Gem::Specification.new do |spec|
3
3
  spec.name = 'joiner'
4
- spec.version = '0.4.2'
4
+ spec.version = '0.5.0'
5
5
  spec.authors = ['Pat Allan']
6
6
  spec.email = ['pat@freelancing-gods.com']
7
7
  spec.summary = %q{Builds ActiveRecord joins from association paths}
@@ -13,10 +13,10 @@ Gem::Specification.new do |spec|
13
13
  spec.test_files = spec.files.grep(%r{^(spec)/})
14
14
  spec.require_paths = ['lib']
15
15
 
16
- spec.add_runtime_dependency 'activerecord', '>= 5.2.beta1'
16
+ spec.add_runtime_dependency 'activerecord', '>= 6.0.0.rc2'
17
17
 
18
- spec.add_development_dependency 'combustion', '~> 0.8'
19
- spec.add_development_dependency 'rails', '>= 5.2.0'
18
+ spec.add_development_dependency 'combustion', '~> 1.1'
19
+ spec.add_development_dependency 'rails', '>= 6.0.0.rc2'
20
20
  spec.add_development_dependency 'rspec-rails', '~> 3'
21
- spec.add_development_dependency 'sqlite3', '~> 1.3.8'
21
+ spec.add_development_dependency 'sqlite3', '~> 1.4'
22
22
  end
@@ -1,10 +1,7 @@
1
1
  class Joiner::JoinDependency < ActiveRecord::Associations::JoinDependency
2
2
  def join_association_for(path, alias_tracker = nil)
3
- if alias_tracker
4
- # ActiveRecord 5.2.1+
5
- @alias_tracker = alias_tracker
6
- construct_tables! join_root
7
- end
3
+ @alias_tracker = alias_tracker
4
+ construct_tables! join_root
8
5
 
9
6
  path.inject(join_root) do |node, piece|
10
7
  node.children.detect { |child| child.reflection.name == piece }
@@ -2,6 +2,8 @@ require 'active_record'
2
2
  require 'active_support/ordered_hash'
3
3
 
4
4
  class Joiner::Joins
5
+ ACTIVE_RECORD_VERSION = Gem::Version.new(ActiveRecord::VERSION::STRING)
6
+
5
7
  attr_reader :model
6
8
 
7
9
  def initialize(model)
@@ -23,13 +25,9 @@ class Joiner::Joins
23
25
  end
24
26
 
25
27
  def join_values
26
- if Joiner::JoinDependency.instance_method(:initialize).arity == 3
27
- # ActiveRecord 5.2.1+
28
- Joiner::JoinDependency.new model, table, joins_cache.to_a
29
- else
30
- # ActiveRecord 5.2.0
31
- Joiner::JoinDependency.new model, table, joins_cache.to_a, alias_tracker
32
- end
28
+ Joiner::JoinDependency.new(
29
+ model, table, joins_cache.to_a, Arel::Nodes::OuterJoin
30
+ )
33
31
  end
34
32
 
35
33
  private
@@ -43,13 +41,7 @@ class Joiner::Joins
43
41
  end
44
42
 
45
43
  def association_for(path)
46
- if Joiner::JoinDependency.instance_method(:initialize).arity == 3
47
- # ActiveRecord 5.2.1+
48
- join_values.join_association_for path, alias_tracker
49
- else
50
- # ActiveRecord 5.2.0
51
- join_values.join_association_for path
52
- end
44
+ join_values.join_association_for path, alias_tracker
53
45
  end
54
46
 
55
47
  def path_as_hash(path)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: joiner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pat Allan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-18 00:00:00.000000000 Z
11
+ date: 2019-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -16,42 +16,42 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 5.2.beta1
19
+ version: 6.0.0.rc2
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 5.2.beta1
26
+ version: 6.0.0.rc2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: combustion
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.8'
33
+ version: '1.1'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0.8'
40
+ version: '1.1'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rails
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: 5.2.0
47
+ version: 6.0.0.rc2
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: 5.2.0
54
+ version: 6.0.0.rc2
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec-rails
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 1.3.8
75
+ version: '1.4'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 1.3.8
82
+ version: '1.4'
83
83
  description: Builds ActiveRecord outer joins from association paths and provides references
84
84
  to table aliases.
85
85
  email:
@@ -89,6 +89,7 @@ extensions: []
89
89
  extra_rdoc_files: []
90
90
  files:
91
91
  - ".gitignore"
92
+ - ".travis.yml"
92
93
  - Gemfile
93
94
  - LICENSE.txt
94
95
  - README.md
@@ -126,8 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
127
  - !ruby/object:Gem::Version
127
128
  version: '0'
128
129
  requirements: []
129
- rubyforge_project:
130
- rubygems_version: 2.7.6
130
+ rubygems_version: 3.0.4
131
131
  signing_key:
132
132
  specification_version: 4
133
133
  summary: Builds ActiveRecord joins from association paths