dbee 1.0.0.pre.alpha.1 → 1.0.0.pre.alpha.2

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: 985c6ab788915c22ed43fea867eb23d4dc4622a2457e814bbedbcd7c42f8d43a
4
- data.tar.gz: ffbceb601e3be40c40f002eb36d8ebc7f2f401add22d18c8b4793de69330cc33
3
+ metadata.gz: fecdbe7976189c6a9b9831e20218d6bca1c194f76db554972ead718cc2a26d36
4
+ data.tar.gz: 6ebbac4f006d91085cc048803c0f683eafcce313cba70e2de8fa744b4d99f981
5
5
  SHA512:
6
- metadata.gz: 5a8c4b1974893e73ef057e947828305b4fcf6ea76733f88758b290b140c956c62a11a1a32de7bc9eb20d82cd70f38e052024bf78511daa2ee1913aae5307b7d1
7
- data.tar.gz: 8b6212eda28dcd468bd2de7325fd635865831a0991a28a3784fad472b3f5fe719aceefa0b5200c0517cad08e47bc6380e0c9a244cf19e5715c51c05ee128ccd3
6
+ metadata.gz: acf29c44149ff9d77b66c248518e5f6bd2cdc0efd3ba3e8f831042557e63ed9512a163478669d7b5563fcb23c9de14e7afa28cc2b64369d18a35a5b0b5a25dd6
7
+ data.tar.gz: 489890fdb0c75e76030bb01274c7178f2b132c587b7f19361ace87c7517ed5079003e4c36df4366a6b04c641827c7cb9b411211213c9e45cfffa0c21b2272208
data/.rubocop.yml CHANGED
@@ -14,7 +14,7 @@ Metrics/MethodLength:
14
14
  Max: 25
15
15
 
16
16
  AllCops:
17
- TargetRubyVersion: 2.3
17
+ TargetRubyVersion: 2.5
18
18
 
19
19
  Metrics/AbcSize:
20
20
  Max: 16
data/.travis.yml CHANGED
@@ -4,8 +4,6 @@ env:
4
4
  language: ruby
5
5
  rvm:
6
6
  # Build on the latest stable of all supported Rubies (https://www.ruby-lang.org/en/downloads/):
7
- - 2.3.8
8
- - 2.4.5
9
7
  - 2.5.3
10
8
  - 2.6.0
11
9
  - 2.6.3
data/Rakefile CHANGED
@@ -9,7 +9,9 @@
9
9
 
10
10
  require 'bundler/gem_tasks'
11
11
  require 'rspec/core/rake_task'
12
+ require 'rubocop/rake_task'
12
13
 
13
14
  RSpec::Core::RakeTask.new(:spec)
15
+ RuboCop::RakeTask.new
14
16
 
15
- task default: :spec
17
+ task default: %i[rubocop spec]
data/dbee.gemspec CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
19
19
  s.homepage = 'https://github.com/bluemarblepayroll/dbee'
20
20
  s.license = 'MIT'
21
21
 
22
- s.required_ruby_version = '>= 2.3.8'
22
+ s.required_ruby_version = '>= 2.5.3'
23
23
 
24
24
  s.add_dependency('acts_as_hashable', '~>1', '>=1.1.0')
25
25
 
data/lib/dbee/base.rb CHANGED
@@ -36,7 +36,7 @@ module Dbee
36
36
  end
37
37
 
38
38
  def table_name
39
- @table_name.to_s
39
+ @table_name || ''
40
40
  end
41
41
 
42
42
  def columns_by_name
@@ -47,12 +47,12 @@ module Dbee
47
47
  @associations_by_name ||= {}
48
48
  end
49
49
 
50
- def inherited_table_name
51
- subclasses.each do |subclass|
52
- return subclass.table_name unless subclass.table_name.empty?
53
- end
50
+ def table_name?
51
+ !table_name.empty?
52
+ end
54
53
 
55
- ''
54
+ def inherited_table_name
55
+ subclasses.find(&:table_name?)&.table_name || ''
56
56
  end
57
57
 
58
58
  def inherited_columns_by_name
@@ -12,8 +12,8 @@ require_relative 'undefined'
12
12
  module Dbee
13
13
  class Model
14
14
  class Columns
15
- # Describes a boolean column. The main value here is the value is pretty pliable.
16
- # For example: the value 'y' or '1' will be coerced to true.
15
+ # Describes a boolean column that can accept a wide range of values and still resolves to
16
+ # a boolean, such as: true, t, yes, y, 1, false, f, n, 0, nil, null.
17
17
  class Boolean < Undefined
18
18
  attr_reader :nullable
19
19
 
@@ -48,15 +48,13 @@ module Dbee
48
48
  val.nil? || val.to_s.empty?
49
49
  end
50
50
 
51
- # rubocop:disable Style/DoubleNegation
52
51
  def nully?(val)
53
- null_or_empty?(val) || !!(val.to_s =~ /(nil|null)$/i)
52
+ null_or_empty?(val) || val.to_s.match?(/\A(nil|null)$\z/i)
54
53
  end
55
54
 
56
55
  def truthy?(val)
57
- !!(val.to_s =~ /(true|t|yes|y|1)$/i)
56
+ val.to_s.match?(/\A(true|t|yes|y|1)$\z/i)
58
57
  end
59
- # rubocop:enable Style/DoubleNegation
60
58
  end
61
59
  end
62
60
  end
data/lib/dbee/model.rb CHANGED
@@ -18,6 +18,8 @@ module Dbee
18
18
 
19
19
  JOIN_CHAR = '.'
20
20
 
21
+ private_constant :JOIN_CHAR
22
+
21
23
  class ModelNotFound < StandardError; end
22
24
 
23
25
  attr_reader :constraints, :name
@@ -27,6 +27,8 @@ module Dbee
27
27
 
28
28
  SPLIT_CHAR = '.'
29
29
 
30
+ private_constant :SPLIT_CHAR
31
+
30
32
  attr_reader :value, :ancestor_names, :column_name
31
33
 
32
34
  def_delegators :value, :to_s
data/lib/dbee/query.rb CHANGED
@@ -32,14 +32,11 @@ module Dbee
32
32
  end
33
33
 
34
34
  def ==(other)
35
- eql?(other)
36
- end
37
-
38
- def eql?(other)
39
35
  other.fields == fields &&
40
36
  other.filters == filters &&
41
37
  other.limit == limit &&
42
38
  other.sorters == sorters
43
39
  end
40
+ alias eql? ==
44
41
  end
45
42
  end
data/lib/dbee/version.rb CHANGED
@@ -8,5 +8,5 @@
8
8
  #
9
9
 
10
10
  module Dbee
11
- VERSION = '1.0.0-alpha.1'
11
+ VERSION = '1.0.0-alpha.2'
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: 1.0.0.pre.alpha.1
4
+ version: 1.0.0.pre.alpha.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Ruggio
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-20 00:00:00.000000000 Z
11
+ date: 2019-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: acts_as_hashable
@@ -213,7 +213,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
213
213
  requirements:
214
214
  - - ">="
215
215
  - !ruby/object:Gem::Version
216
- version: 2.3.8
216
+ version: 2.5.3
217
217
  required_rubygems_version: !ruby/object:Gem::Requirement
218
218
  requirements:
219
219
  - - ">"