inquery 1.0.4 → 1.0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  Top Level Namespace
8
8
 
9
- &mdash; Documentation by YARD 0.9.25
9
+ &mdash; Documentation by YARD 0.9.26
10
10
 
11
11
  </title>
12
12
 
@@ -100,9 +100,9 @@
100
100
  </div>
101
101
 
102
102
  <div id="footer">
103
- Generated on Tue Nov 24 16:32:43 2020 by
103
+ Generated on Wed Feb 24 10:57:42 2021 by
104
104
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
105
- 0.9.25 (ruby-2.6.2).
105
+ 0.9.26 (ruby-2.6.2).
106
106
  </div>
107
107
 
108
108
  </div>
data/inquery.gemspec CHANGED
@@ -1,14 +1,14 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: inquery 1.0.4 ruby lib
2
+ # stub: inquery 1.0.9 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "inquery".freeze
6
- s.version = "1.0.4"
6
+ s.version = "1.0.9"
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
9
9
  s.require_paths = ["lib".freeze]
10
10
  s.authors = ["Sitrox".freeze]
11
- s.date = "2020-11-24"
11
+ s.date = "2021-02-24"
12
12
  s.files = [".gitignore".freeze, ".releaser_config".freeze, ".rubocop.yml".freeze, ".travis.yml".freeze, ".yardopts".freeze, "CHANGELOG.md".freeze, "Gemfile".freeze, "LICENSE".freeze, "README.md".freeze, "RUBY_VERSION".freeze, "Rakefile".freeze, "VERSION".freeze, "doc/Inquery.html".freeze, "doc/Inquery/Exceptions.html".freeze, "doc/Inquery/Exceptions/Base.html".freeze, "doc/Inquery/Exceptions/InvalidRelation.html".freeze, "doc/Inquery/Exceptions/UnknownCallSignature.html".freeze, "doc/Inquery/Mixins.html".freeze, "doc/Inquery/Mixins/RawSqlUtils.html".freeze, "doc/Inquery/Mixins/RelationValidation.html".freeze, "doc/Inquery/Mixins/RelationValidation/ClassMethods.html".freeze, "doc/Inquery/Mixins/SchemaValidation.html".freeze, "doc/Inquery/Mixins/SchemaValidation/ClassMethods.html".freeze, "doc/Inquery/Query.html".freeze, "doc/Inquery/Query/Chainable.html".freeze, "doc/_index.html".freeze, "doc/class_list.html".freeze, "doc/css/common.css".freeze, "doc/css/full_list.css".freeze, "doc/css/style.css".freeze, "doc/file.README.html".freeze, "doc/file_list.html".freeze, "doc/frames.html".freeze, "doc/index.html".freeze, "doc/js/app.js".freeze, "doc/js/full_list.js".freeze, "doc/js/jquery.js".freeze, "doc/method_list.html".freeze, "doc/top-level-namespace.html".freeze, "inquery.gemspec".freeze, "lib/inquery.rb".freeze, "lib/inquery/exceptions.rb".freeze, "lib/inquery/mixins/raw_sql_utils.rb".freeze, "lib/inquery/mixins/relation_validation.rb".freeze, "lib/inquery/mixins/schema_validation.rb".freeze, "lib/inquery/query.rb".freeze, "lib/inquery/query/chainable.rb".freeze, "test/db/models.rb".freeze, "test/db/schema.rb".freeze, "test/inquery/query/chainable_test.rb".freeze, "test/inquery/query_test.rb".freeze, "test/queries/group/fetch_as_json.rb".freeze, "test/queries/group/fetch_green.rb".freeze, "test/queries/group/fetch_red.rb".freeze, "test/queries/group/filter_with_color.rb".freeze, "test/queries/user/fetch_all.rb".freeze, "test/queries/user/fetch_in_group.rb".freeze, "test/queries/user/fetch_in_group_rel.rb".freeze, "test/test_helper.rb".freeze]
13
13
  s.rubygems_version = "3.0.3".freeze
14
14
  s.summary = "A skeleton that allows extracting queries into atomic, reusable classes.".freeze
@@ -23,24 +23,24 @@ Gem::Specification.new do |s|
23
23
  s.add_development_dependency(%q<sqlite3>.freeze, [">= 0"])
24
24
  s.add_development_dependency(%q<haml>.freeze, [">= 0"])
25
25
  s.add_development_dependency(%q<yard>.freeze, [">= 0"])
26
- s.add_development_dependency(%q<rubocop>.freeze, ["= 0.35.1"])
26
+ s.add_development_dependency(%q<rubocop>.freeze, ["= 0.92.0"])
27
27
  s.add_development_dependency(%q<redcarpet>.freeze, [">= 0"])
28
28
  s.add_runtime_dependency(%q<minitest>.freeze, [">= 0"])
29
29
  s.add_runtime_dependency(%q<activesupport>.freeze, [">= 0"])
30
30
  s.add_runtime_dependency(%q<activerecord>.freeze, [">= 0"])
31
- s.add_runtime_dependency(%q<schemacop>.freeze, [">= 2.0"])
31
+ s.add_runtime_dependency(%q<schemacop>.freeze, ["~> 3.0.8"])
32
32
  else
33
33
  s.add_dependency(%q<bundler>.freeze, [">= 0"])
34
34
  s.add_dependency(%q<rake>.freeze, [">= 0"])
35
35
  s.add_dependency(%q<sqlite3>.freeze, [">= 0"])
36
36
  s.add_dependency(%q<haml>.freeze, [">= 0"])
37
37
  s.add_dependency(%q<yard>.freeze, [">= 0"])
38
- s.add_dependency(%q<rubocop>.freeze, ["= 0.35.1"])
38
+ s.add_dependency(%q<rubocop>.freeze, ["= 0.92.0"])
39
39
  s.add_dependency(%q<redcarpet>.freeze, [">= 0"])
40
40
  s.add_dependency(%q<minitest>.freeze, [">= 0"])
41
41
  s.add_dependency(%q<activesupport>.freeze, [">= 0"])
42
42
  s.add_dependency(%q<activerecord>.freeze, [">= 0"])
43
- s.add_dependency(%q<schemacop>.freeze, [">= 2.0"])
43
+ s.add_dependency(%q<schemacop>.freeze, ["~> 3.0.8"])
44
44
  end
45
45
  else
46
46
  s.add_dependency(%q<bundler>.freeze, [">= 0"])
@@ -48,11 +48,11 @@ Gem::Specification.new do |s|
48
48
  s.add_dependency(%q<sqlite3>.freeze, [">= 0"])
49
49
  s.add_dependency(%q<haml>.freeze, [">= 0"])
50
50
  s.add_dependency(%q<yard>.freeze, [">= 0"])
51
- s.add_dependency(%q<rubocop>.freeze, ["= 0.35.1"])
51
+ s.add_dependency(%q<rubocop>.freeze, ["= 0.92.0"])
52
52
  s.add_dependency(%q<redcarpet>.freeze, [">= 0"])
53
53
  s.add_dependency(%q<minitest>.freeze, [">= 0"])
54
54
  s.add_dependency(%q<activesupport>.freeze, [">= 0"])
55
55
  s.add_dependency(%q<activerecord>.freeze, [">= 0"])
56
- s.add_dependency(%q<schemacop>.freeze, [">= 2.0"])
56
+ s.add_dependency(%q<schemacop>.freeze, ["~> 3.0.8"])
57
57
  end
58
58
  end
@@ -3,12 +3,12 @@ module Inquery
3
3
  module RelationValidation
4
4
  extend ActiveSupport::Concern
5
5
 
6
- if defined?(Schemacop::V2)
7
- OPTIONS_SCHEMA = Schemacop::Node.create :object do
6
+ if defined?(Schemacop::Schema3)
7
+ OPTIONS_SCHEMA = Schemacop::Schema3.new(:hash) do
8
8
  str? :class
9
9
  int? :fields
10
10
  sym? :default_select
11
- rby? :default, [Proc, FalseClass]
11
+ obj? :default, classes: [Proc, FalseClass]
12
12
  end
13
13
  else
14
14
  OPTIONS_SCHEMA = Schemacop::Schema.new do
@@ -24,26 +24,26 @@ module Inquery
24
24
  # `nil` to not perform any checks. The `class` attribute will also be
25
25
  # taken to infer a default if no relation is given and you didn't
26
26
  # specify any `default`.
27
- class: nil,
27
+ class: nil,
28
28
 
29
29
  # This allows to specify a default relation that will be taken if no
30
30
  # relation is given. This must be specified as a Proc returning the
31
31
  # relation. Set this to `false` for no default. If this is set to `nil`,
32
32
  # it will try to infer the default from the option `class` (if given).
33
- default: nil,
33
+ default: nil,
34
34
 
35
35
  # Allows to restrict the number of fields / values the relation must
36
36
  # select. This is particularly useful if you're using the query as a
37
37
  # subquery and need it to return exactly one field. Use `nil` to not
38
38
  # perform any checks.
39
- fields: nil,
39
+ fields: nil,
40
40
 
41
41
  # If this is set to a symbol, the relation does not have any select
42
42
  # fields specified (`select_values` is empty) and `fields` is > 0, it
43
43
  # will automatically select the given field. Use `nil` to disable this
44
44
  # behavior.
45
45
  default_select: :id
46
- }
46
+ }.freeze
47
47
 
48
48
  included do
49
49
  class_attribute :_relation_options
@@ -91,7 +91,7 @@ module Inquery
91
91
  # ---------------------------------------------------------------
92
92
  fields_count = relation.select_values.size
93
93
 
94
- if fields_count == 0 && options[:default_select] && options[:fields] && options[:fields] > 0
94
+ if fields_count.zero? && options[:default_select] && options[:fields] && (options[:fields]).positive?
95
95
  relation = relation.select(options[:default_select])
96
96
  fields_count = 1
97
97
  end
@@ -9,14 +9,21 @@ module Inquery
9
9
  end
10
10
 
11
11
  module ClassMethods
12
- def schema(*args, &block)
13
- if defined?(Schemacop::V2)
14
- schema = Schemacop::V2::Schema.new(*args, &block)
12
+ def schema2(*args, &block)
13
+ self._schema = Schemacop::Schema.new(*args, &block)
14
+ end
15
+
16
+ def schema3(reference = nil, **options, &block)
17
+ if reference
18
+ self._schema = Schemacop::Schema3.new(:reference, options.merge(path: reference))
15
19
  else
16
- schema = Schemacop::Schema.new(*args, &block)
20
+ self._schema = Schemacop::Schema3.new(:hash, **options, &block)
17
21
  end
22
+ end
18
23
 
19
- self._schema = schema
24
+ # @see schema2
25
+ def schema(*args, &block)
26
+ schema2(*args, &block)
20
27
  end
21
28
  end
22
29
  end
data/test/test_helper.rb CHANGED
@@ -10,7 +10,7 @@ module TestHelper
10
10
 
11
11
  module ClassMethods
12
12
  def setup_db
13
- load File.dirname(__FILE__) + '/db/schema.rb'
13
+ load "#{File.dirname(__FILE__)}/db/schema.rb"
14
14
  end
15
15
 
16
16
  def setup_base_data
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inquery
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sitrox
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-24 00:00:00.000000000 Z
11
+ date: 2021-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - '='
88
88
  - !ruby/object:Gem::Version
89
- version: 0.35.1
89
+ version: 0.92.0
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - '='
95
95
  - !ruby/object:Gem::Version
96
- version: 0.35.1
96
+ version: 0.92.0
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: redcarpet
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -154,18 +154,18 @@ dependencies:
154
154
  name: schemacop
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - ">="
157
+ - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: '2.0'
159
+ version: 3.0.8
160
160
  type: :runtime
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - ">="
164
+ - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: '2.0'
167
- description:
168
- email:
166
+ version: 3.0.8
167
+ description:
168
+ email:
169
169
  executables: []
170
170
  extensions: []
171
171
  extra_rdoc_files: []
@@ -229,10 +229,10 @@ files:
229
229
  - test/queries/user/fetch_in_group.rb
230
230
  - test/queries/user/fetch_in_group_rel.rb
231
231
  - test/test_helper.rb
232
- homepage:
232
+ homepage:
233
233
  licenses: []
234
234
  metadata: {}
235
- post_install_message:
235
+ post_install_message:
236
236
  rdoc_options: []
237
237
  require_paths:
238
238
  - lib
@@ -247,8 +247,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
247
247
  - !ruby/object:Gem::Version
248
248
  version: '0'
249
249
  requirements: []
250
- rubygems_version: 3.1.4
251
- signing_key:
250
+ rubygems_version: 3.0.3
251
+ signing_key:
252
252
  specification_version: 4
253
253
  summary: A skeleton that allows extracting queries into atomic, reusable classes.
254
254
  test_files: