dbee 2.1.0.pre.alpha → 2.1.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: acc518f50b6b9e95165347240882ca415194e6b641e68ff292d5b2a6d3937527
4
- data.tar.gz: 954dbcdfac112f2098e7c1828d8c243369092526ee65179c9819ceaafddc70f7
3
+ metadata.gz: c8881fb69d8398471e0857f9b8e01a1452aaf6688a3a30aa38868b8254549e9c
4
+ data.tar.gz: ca28fbd217d3a8c7daa2c41e5d9ea7d24173ab1b57c48467c9700c5b4871c01e
5
5
  SHA512:
6
- metadata.gz: 5731c83ec9b0ded7f36c6b07d16597f97337240bd65bbec7dc82a9ca7f4de4da0cac9063a6e9aa9cf8199e6f5c32e7ab0a2904684b64bebde9e996f9bceb8e41
7
- data.tar.gz: c47a038d7fac640a620a13373460bbd8df05a35b209264de1b0fedd727eab072925d0f2cfa82a800ddd2362756f887b0cd227d1e1cd01c98a0334b1c3cd55cd0
6
+ metadata.gz: b1cdd0b920c5ee6c02829eebe6e9d2851401eb996f2573f8524eba027de10102e9c706de9468cfeec503ec2ecf28cce525f2511ef0952c9204bf49462bd262be
7
+ data.tar.gz: 6e6e2d772a318b8cc8960300b45ecb830bbde5973e567295eddff15f287ebf453e09df30de1d686d8a0ee157d590d4af0d48cd71e87012cc1d0606d952c2cac6
@@ -1,15 +1,10 @@
1
1
  AllCops:
2
2
  TargetRubyVersion: 2.5
3
+ NewCops: enable
3
4
 
4
5
  Layout/LineLength:
5
6
  Max: 100
6
7
 
7
- Lint/RaiseException:
8
- Enabled: True
9
-
10
- Lint/StructNewOverride:
11
- Enabled: True
12
-
13
8
  Metrics/AbcSize:
14
9
  Max: 16
15
10
 
@@ -27,12 +22,3 @@ Metrics/ClassLength:
27
22
 
28
23
  Metrics/MethodLength:
29
24
  Max: 25
30
-
31
- Style/HashEachMethods:
32
- Enabled: True
33
-
34
- Style/HashTransformKeys:
35
- Enabled: True
36
-
37
- Style/HashTransformValues:
38
- Enabled: True
@@ -1,4 +1,4 @@
1
- # 2.1.0 (TBD)
1
+ # 2.1.0 (July 13th, 2020)
2
2
 
3
3
  ### Additions:
4
4
 
@@ -36,7 +36,7 @@ Gem::Specification.new do |s|
36
36
  s.add_development_dependency('pry', '~>0')
37
37
  s.add_development_dependency('rake', '~> 13')
38
38
  s.add_development_dependency('rspec')
39
- s.add_development_dependency('rubocop', '~>0.81.0')
39
+ s.add_development_dependency('rubocop', '~>0.88.0')
40
40
  s.add_development_dependency('simplecov', '~>0.17.0')
41
41
  s.add_development_dependency('simplecov-console', '~>0.7.0')
42
42
  end
@@ -23,13 +23,24 @@ module Dbee
23
23
 
24
24
  class NoFieldsError < StandardError; end
25
25
 
26
- attr_reader :fields, :filters, :limit, :sorters
26
+ attr_reader :fields,
27
+ :filters,
28
+ :groupers,
29
+ :limit,
30
+ :sorters
27
31
 
28
- def_delegator :fields, :sort, :sorted_fields
29
- def_delegator :filters, :sort, :sorted_filters
30
- def_delegator :sorters, :sort, :sorted_sorters
32
+ def_delegator :fields, :sort, :sorted_fields
33
+ def_delegator :filters, :sort, :sorted_filters
34
+ def_delegator :sorters, :sort, :sorted_sorters
35
+ def_delegator :groupers, :sort, :sorted_groupers
31
36
 
32
- def initialize(fields:, filters: [], limit: nil, sorters: [])
37
+ def initialize(
38
+ fields:,
39
+ filters: [],
40
+ groupers: [],
41
+ limit: nil,
42
+ sorters: []
43
+ )
33
44
  @fields = Field.array(fields)
34
45
 
35
46
  # If no fields were passed into a query then we will have no data to return.
@@ -38,6 +49,7 @@ module Dbee
38
49
  raise NoFieldsError if @fields.empty?
39
50
 
40
51
  @filters = Filters.array(filters).uniq
52
+ @groupers = Array(groupers).map { |k| KeyPath.get(k) }.uniq
41
53
  @limit = limit.to_s.empty? ? nil : limit.to_i
42
54
  @sorters = Sorters.array(sorters).uniq
43
55
 
@@ -46,10 +58,10 @@ module Dbee
46
58
 
47
59
  def ==(other)
48
60
  other.instance_of?(self.class) &&
61
+ other.limit == limit &&
49
62
  other.sorted_fields == sorted_fields &&
50
63
  other.sorted_filters == sorted_filters &&
51
- other.sorted_sorters == sorted_sorters &&
52
- other.limit == limit
64
+ other.sorted_sorters == sorted_sorters
53
65
  end
54
66
  alias eql? ==
55
67
 
@@ -60,7 +72,11 @@ module Dbee
60
72
  private
61
73
 
62
74
  def key_paths
63
- (fields.map(&:key_path) + filters.map(&:key_path) + sorters.map(&:key_path))
75
+ (
76
+ fields.flat_map(&:key_paths) +
77
+ filters.map(&:key_path) +
78
+ sorters.map(&:key_path)
79
+ )
64
80
  end
65
81
  end
66
82
  end
@@ -71,6 +71,10 @@ module Dbee
71
71
  def <=>(other)
72
72
  "#{key_path}#{display}" <=> "#{other.key_path}#{other.display}"
73
73
  end
74
+
75
+ def key_paths
76
+ [key_path] + filters.map(&:key_path)
77
+ end
74
78
  end
75
79
  end
76
80
  end
@@ -8,5 +8,5 @@
8
8
  #
9
9
 
10
10
  module Dbee
11
- VERSION = '2.1.0-alpha'
11
+ VERSION = '2.1.0'
12
12
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dbee
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0.pre.alpha
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Ruggio
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-07-03 00:00:00.000000000 Z
11
+ date: 2020-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: acts_as_hashable
@@ -106,14 +106,14 @@ dependencies:
106
106
  requirements:
107
107
  - - "~>"
108
108
  - !ruby/object:Gem::Version
109
- version: 0.81.0
109
+ version: 0.88.0
110
110
  type: :development
111
111
  prerelease: false
112
112
  version_requirements: !ruby/object:Gem::Requirement
113
113
  requirements:
114
114
  - - "~>"
115
115
  - !ruby/object:Gem::Version
116
- version: 0.81.0
116
+ version: 0.88.0
117
117
  - !ruby/object:Gem::Dependency
118
118
  name: simplecov
119
119
  requirement: !ruby/object:Gem::Requirement
@@ -244,9 +244,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
244
244
  version: '2.5'
245
245
  required_rubygems_version: !ruby/object:Gem::Requirement
246
246
  requirements:
247
- - - ">"
247
+ - - ">="
248
248
  - !ruby/object:Gem::Version
249
- version: 1.3.1
249
+ version: '0'
250
250
  requirements: []
251
251
  rubygems_version: 3.0.3
252
252
  signing_key: